THE PATH TO SUCCESS IN EXAM...
Introduction to Problem Solving – Notes
Introduction to problem solving.
- Steps for problem solving ( analysing the problem, developing an algorithm, coding, testing and debugging).
- flow chart and
- pseudo code,
Decomposition
Introduction
Computers is machine that not only use to develop the software. It is also used for solving various day-to-day problems.
Computers cannot solve a problem by themselves. It solve the problem on basic of the step-by-step instructions given by us.
Thus, the success of a computer in solving a problem depends on how correctly and precisely we –
- Identifying (define) the problem
- Designing & developing an algorithm and
- Implementing the algorithm (solution) do develop a program using any programming language.
Thus problem solving is an essential skill that a computer science student should know.
Steps for Problem Solving-
1. Analysing the problem
Analysing the problems means understand a problem clearly before we begin to find the solution for it. Analysing a problem helps to figure out what are the inputs that our program should accept and the outputs that it should produce.
2. Developing an Algorithm
It is essential to device a solution before writing a program code for a given problem. The solution is represented in natural language and is called an algorithm.
Algorithm: A set of exact steps which when followed, solve the problem or accomplish the required task.
Coding is the process of converting the algorithm into the program which can be understood by the computer to generate the desired solution.
You can use any high level programming languages for writing a program.
4. Testing and Debugging
The program created should be tested on various parameters.
- The program should meet the requirements of the user.
- It must respond within the expected time.
- It should generate correct output for all possible inputs.
- In the presence of syntactical errors, no output will be obtained.
- In case the output generated is incorrect, then the program should be checked for logical errors, if any.
Software Testing methods are
- unit or component testing,
- integration testing,
- system testing, and
- acceptance testing
Debugging – The errors or defects found in the testing phases are debugged or rectified and the program is again tested. This continues till all the errors are removed from the program.
Algorithm is a set of sequence which followed to solve a problem.
Algorithm for an activity ‘riding a bicycle’: 1) remove the bicycle from the stand, 2) sit on the seat of the bicycle, 3) start peddling, 4) use breaks whenever needed and 5) stop on reaching the destination.
Algorithm for Computing GCD of two numbers:
Step 1: Find the numbers (divisors) which can divide the given numbers.
Step 2: Then find the largest common number from these two lists.
A finite sequence of steps required to get the desired output is called an algorithm. Algorithm has a definite beginning and a definite end, and consists of a finite number of steps.
Characteristics of a good algorithm
- Precision — the steps are precisely stated or defined.
- Uniqueness — results of each step are uniquely defined and only depend on the input and the result of the preceding steps.
- Finiteness — the algorithm always stops after a finite number of steps.
- Input — the algorithm receives some input.
- Output — the algorithm produces some output.
While writing an algorithm, it is required to clearly identify the following:
- The input to be taken from the user.
- Processing or computation to be performed to get the desired result.
- The output desired by the user.
Representation of Algorithms
There are two common methods of representing an algorithm —
Flowchart — Visual Representation of Algorithms
A flowchart is a visual representation of an algorithm. A flowchart is a diagram made up of boxes, diamonds and other shapes, connected by arrows. Each shape represents a step of the solution process and the arrow represents the order or link among the steps. There are standardised symbols to draw flowcharts.
Start/End – Also called “Terminator” symbol. It indicates where the flow starts and ends.
Process – Also called “Action Symbol,” it represents a process, action, or a single step. Decision – A decision or branching point, usually a yes/no or true/ false question is asked, and based on the answer, the path gets split into two branches.
Input / Output – Also called data symbol, this parallelogram shape is used to input or output data.
Arrow – Connector to show order of flow between shapes.
Question: Write an algorithm to find the square of a number. Algorithm to find square of a number. Step 1: Input a number and store it to num Step 2: Compute num * num and store it in square Step 3: Print square
The algorithm to find square of a number can be represented pictorially using flowchart
A pseudocode (pronounced Soo-doh-kohd) is another way of representing an algorithm. It is considered as a non-formal language that helps programmers to write algorithm. It is a detailed description of instructions that a computer must follow in a particular order.
- It is intended for human reading and cannot be executed directly by the computer.
- No specific standard for writing a pseudocode exists.
- The word “pseudo” means “not real,” so “pseudocode” means “not real code”.
Keywords are used in pseudocode:
Question : Write an algorithm to calculate area and perimeter of a rectangle, using both pseudocode and flowchart.
Pseudocode for calculating area and perimeter of a rectangle.
INPUT length INPUT breadth COMPUTE Area = length * breadth PRINT Area COMPUTE Perim = 2 * (length + breadth) PRINT Perim The flowchart for this algorithm
Benefits of Pseudocode
- A pseudocode of a program helps in representing the basic functionality of the intended program.
- By writing the code first in a human readable language, the programmer safeguards against leaving out any important step.
- For non-programmers, actual programs are difficult to read and understand, but pseudocode helps them to review the steps to confirm that the proposed implementation is going to achieve the desire output.
Flow of Control :
The flow of control depicts the flow of process as represented in the flow chart. The process can flow in
In a sequence steps of algorithms (i.e. statements) are executed one after the other.
In a selection, steps of algorithm is depend upon the conditions i.e. any one of the alternatives statement is selected based on the outcome of a condition.
Conditionals are used to check possibilities. The program checks one or more conditions and perform operations (sequence of actions) depending on true or false value of the condition.
Conditionals are written in the algorithm as follows: If is true then steps to be taken when the condition is true/fulfilled otherwise steps to be taken when the condition is false/not fulfilled
Question : Write an algorithm to check whether a number is odd or even. • Input: Any number • Process: Check whether the number is even or not • Output: Message “Even” or “Odd” Pseudocode of the algorithm can be written as follows: PRINT “Enter the Number” INPUT number IF number MOD 2 == 0 THEN PRINT “Number is Even” ELSE PRINT “Number is Odd”
The flowchart representation of the algorithm
Repetitions are used, when we want to do something repeatedly, for a given number of times.
Question : Write pseudocode and draw flowchart to accept numbers till the user enters 0 and then find their average. Pseudocode is as follows:
Step 1: Set count = 0, sum = 0 Step 2: Input num Step 3: While num is not equal to 0, repeat Steps 4 to 6 Step 4: sum = sum + num Step 5: count = count + 1 Step 6: Input num Step 7: Compute average = sum/count Step 8: Print average The flowchart representation is
Once an algorithm is finalised, it should be coded in a high-level programming language as selected by the programmer. The ordered set of instructions are written in that programming language by following its syntax.
The syntax is the set of rules or grammar that governs the formulation of the statements in the language, such as spelling, order of words, punctuation, etc.
Source Code: A program written in a high-level language is called source code.
We need to translate the source code into machine language using a compiler or an interpreter so that it can be understood by the computer.
Decomposition is a process to ‘decompose’ or break down a complex problem into smaller subproblems. It is helpful when we have to solve any big or complex problem.
- Breaking down a complex problem into sub problems also means that each subproblem can be examined in detail.
- Each subproblem can be solved independently and by different persons (or teams).
- Having different teams working on different sub-problems can also be advantageous because specific sub-problems can be assigned to teams who are experts in solving such problems.
Once the individual sub-problems are solved, it is necessary to test them for their correctness and integrate them to get the complete solution.
- Input Output in Python
Related Posts
Society, Law, and Ethics: Societal Impacts – Notes
Data structure: stacks – notes.
Python Revision Tour I : Basics of Python – Notes
Introduction to Python Module – Notes
Sorting Techniques in Python – Notes
Dictionary handling in python – notes, tuples manipulation in python notes, list manipulation – notes, leave a comment cancel reply.
You must be logged in to post a comment.
You cannot copy content of this page
- Computer Science and Engineering
- NOC:Problem Solving through Programming in C (Video)
- Co-ordinated by : IIT Kharagpur
- Available from : 2017-12-21
- Intro Video
- Lecture 1 : Introduction
- Lecture 2 : Idea of Algorithms
- Lecture 3 : Flow Chart and Pseudocode
- Lecture 4 : Introduction to Programming Language Concepts
- Lecture 5 : Variables and Memory
- Lecture 6 : Types of Software and Compilers
- Lecture 7 : Introduction to C Programming Language
- Lecture 8 : Variables and Variable Types in C
- Lecture 9 : Introducing Functions
- Lecture 10 : Address and Content of Variables and Types
- Lecture 11 : Assignment Statement and Operators in C
- Lecture 12 : Arithmetic Expressions and Relational Expressions
- Lecture 13 : Logical Operators and Change in Control Flow
- Lecture 14 : Use of Logical Operaotrs in Branching
- Lecture 15 : Branching : IF - ELSE Statement
- Lecture 16 : IF-ELSE Statement (Contd.)
- Lecture 17 : Switch statement
- Lecture 18 : Switch Statement (Contd.) and Introduction to Loops
- Lecture 19 : Implementing Repetitions (Loops)
- Lecture 20 : Implementation of Loops with for Statement (Contd.)
- Lecture 21 : For Statement (Contd.)
- Lecture 22 : Example of If-Else
- Lecture 23 : Example of Loops
- Lecture 24 : Example of Loops (Contd.)
- Lecture 25: Example of Loops (Contd.), Use of FOR Loops
- Lecture 26 : Introduction to Arrays
- Lecture 27 : Arrays (Contd.)
- Lecture 28 : Arrays (Contd.)
- Lecture 29 : Program using Arrays
- Lecture 30 : Array Problem
- Lecture 31 : Linear Search
- Lecture 32 : Character Array and Strings
- Lecture 33 : String Operations
- Lecture 34 : 2-D Array Operation
- Lecture 35 : Introducing Functions
- Lecture 36 : More on Functions
- Lecture 37 : Function (Contd.)
- Lecture 38 : Scanf and Printf Functions; Function Prototype
- Lecture 39 : Parameter Passing in Function Revision
- Lecture 40 : Parameter Passing in Function Revision (Contd.)
- Lecture 41: Substitution of # include and Macro
- Lecture 42: "search" as a function
- Lecture 43: Binary Search
- Lecture 44: Binary Search (Contd.)
- Lecture 45: Sorting Methods
- Lecture 46 : Bubble Sort (Contd.)
- Lecture 47 : Use of Pointer in Function : Context Bubble Sort
- Lecture 48 : Arrays at Strings
- Lecture 49 : Data Representation
- Lecture 50 : Bisection Method
- Lecture 51 : Interpolation
- Lecture 52 : Trapezoidal Rule and Runge-Kutta Method
- Lecture 53 : Recursion
- Lecture 54 : Recursion(Contd.)
- Lecture 55 : Structure
- Lecture 56 : Structure (Contd.)
- Lecture 57 : Structure with typedef
- Lecture 58 : Pointer
- Lecture 59 : Pointer (Contd.)
- Lecture 60 : Pointer in Structures
- Lecture 61 : Dynamic Allocation and File
- Week 2 - PMRF Live Session
- Week 3 - PMRF Live Session
- Watch on YouTube
- Assignments
- Download Videos
- Transcripts
- Handouts (3)
Introduction to Problem Solving Class 11 Notes | CBSE Computer Science
Latest Problem Solving Class 11 Notes includes Problem Solving, steps, algorithm and its need, flow chart, pseudo code with lots of examples.
- 1 What is Problem Solving?
- 2 Steps for problem solving
- 3 What is Algorithm?
- 4 Why do we need Algorithm?
- 5.1 Flow chart
- 5.2 Flow Chart Examples
- 5.3 Pseudo code
- 5.4 Pseudo Code Example
- 6.1 Selection
- 6.2 Algorithm, Pseudocode, Flowchart with Selection ( Using if ) Examples
- 6.3 Repetition
- 6.4 Algorithm, Pseudocode, Flowchart with Repetition ( Loop ) Examples
- 7 Decomposition
What is Problem Solving?
Problem solving is the process of identifying a problem, analyze the problem, developing an algorithm for the identified problem and finally implementing the algorithm to develop program.
Steps for problem solving
There are 4 basic steps involved in problem solving
Analyze the problem
- Developing an algorithm
- Testing and debugging
Analyzing the problem is basically understanding a problem very clearly before finding its solution. Analyzing a problem involves
- List the principal components of the problem
- List the core functionality of the problem
- Figure out inputs to be accepted and output to be produced
Developing an Algorithm
- A set of precise and sequential steps written to solve a problem
- The algorithm can be written in natural language
- There can be more than one algorithm for a problem among which we can select the most suitable solution.
Algorithm written in natural language is not understood by computer and hence it has to be converted in machine language. And to do so program based on that algorithm is written using high level programming language for the computer to get the desired solution.
Testing and Debugging
After writing program it has to be tested on various parameters to ensure that program is producing correct output within expected time and meeting the user requirement.
There are many standard software testing methods used in IT industry such as
- Component testing
- Integration testing
- System testing
- Acceptance testing
What is Algorithm?
- A set of precise, finite and sequential set of steps written to solve a problem and get the desired output.
- Algorithm has definite beginning and definite end.
- It lead to desired result in finite amount of time of followed correctly.
Why do we need Algorithm?
- Algorithm helps programmer to visualize the instructions to be written clearly.
- Algorithm enhances the reliability, accuracy and efficiency of obtaining solution.
- Algorithm is the easiest way to describe problem without going into too much details.
- Algorithm lets programmer understand flow of problem concisely.
Characteristics of a good algorithm
- Precision — the steps are precisely stated or defined.
- Uniqueness — results of each step are uniquely defined and only depend on the input and the result of the preceding steps.
- Finiteness — the algorithm always stops after a finite number of steps.
- Input — the algorithm receives some input.
- Output — the algorithm produces some output.
What are the points that should be clearly identified while writing Algorithm?
- The input to be taken from the user
- Processing or computation to be performed to get the desired result
- The output desired by the user
Representation of Algorithm
An algorithm can be represented in two ways:
Pseudo code
- Flow chart is visual representation of an algorithm.
- It’s a diagram made up of boxes, diamonds and other shapes, connected by arrows.
- Each step represents a step of solution process.
- Arrows in the follow chart represents the flow and link among the steps.
Flow Chart Examples
Example 1: Write an algorithm to divide a number by another and display the quotient.
Input: Two Numbers to be divided Process: Divide number1 by number2 to get the quotient Output: Quotient of division
Step 1: Input a two numbers and store them in num1 and num2 Step 2: Compute num1/num2 and store its quotient in num3 Step 3: Print num3
- Pseudo code means ‘not real code’.
- A pseudo code is another way to represent an algorithm. It is an informal language used by programmer to write algorithms.
- It does not require strict syntax and technological support.
- It is a detailed description of what algorithm would do.
- It is intended for human reading and cannot be executed directly by computer.
- There is no specific standard for writing a pseudo code exists.
Keywords used in writing pseudo code
Pseudo Code Example
Example: write an algorithm to display the square of a given number.
Input, Process and Output Identification
Input: Number whose square is required Process: Multiply the number by itself to get its square Output: Square of the number
Step 1: Input a number and store it to num. Step 2: Compute num * num and store it in square. Step 3: Print square.
INPUT num COMPUTE square = num*num PRINT square
Example: Write an algorithm to calculate area and perimeter of a rectangle, using both pseudo code and flowchart.
INPUT L INPUT B COMPUTER Area = L * B PRINT Area COMPUTE Perimeter = 2 * ( L + B ) PRINT Perimeter
Flow of Control
An algorithm is considered as finite set of steps that are executed in a sequence. But sometimes the algorithm may require executing some steps conditionally or repeatedly. In such situations algorithm can be written using
Selection in algorithm refers to Conditionals which means performing operations (sequence of steps) depending on True or False value of given conditions. Conditionals are written in the algorithm as follows:
If <condition> then Steps to be taken when condition is true Otherwise Steps to be taken when condition is false
Algorithm, Pseudocode, Flowchart with Selection ( Using if ) Examples
Example: write an algorithm, pseudocode and flowchart to display larger between two numbers
INPUT: Two numbers to be compared PROCESS: compare two numbers and depending upon True and False value of comparison display result OUTPUT: display larger no
STEP1: read two numbers in num1, num2 STEP 2: if num1 > num2 then STEP 3: display num1 STEP 4: else STEP 5: display num2
INPUT num1 , num2 IF num1 > num2 THEN PRINT “num1 is largest” ELSE PRINT “num2 is largest” ENDIF
Example: write pseudocode and flowchart to display largest among three numbers
INPUT: Three numbers to be compared PROCESS: compare three numbers and depending upon True and False value of comparison display result OUTPUT: display largest number
INPUT num1, num2, num3 PRINT “Enter three numbers” IF num1 > num2 THEN IF num1 > num3 THEN PRINT “num1 is largest” ELSE PRINT “num3 is largest” END IF ELSE IF num2 > num3 THEN PRINT “num2 is largest” ELSE PRINT “num3 is largest” END IF END IF
- Repetition in algorithm refers to performing operations (Set of steps) repeatedly for a given number of times (till the given condition is true).
- Repetition is also known as Iteration or Loop
Repetitions are written in algorithm is as follows:
While <condition>, repeat step numbers Steps to be taken when condition is true End while
Algorithm, Pseudocode, Flowchart with Repetition ( Loop ) Examples
Example: write an algorithm, pseudocode and flow chart to display “Techtipnow” 10 times
Step1: Set count = 0 Step2: while count is less than 10, repeat step 3,4 Step 3: print “techtipnow” Step 4: count = count + 1 Step 5: End while
SET count = 0 WHILE count<10 PRINT “Techtipnow” Count = count + 1 END WHILE
Example: Write pseudocode and flow chart to calculate total of 10 numbers
Step 1: SET count = 0, total = 0 Step 2: WHILE count < 10, REPEAT steps 3 to 5 Step 3: INPUT a number in var Step 4: COMPUTE total = total + var Step 5: count = count + 1 Step 6: END WHILE Step 7: PRINT total
Example: Write pseudo code and flow chart to find factorial of a given number
Step 1: SET fact = 1 Step 2: INPUT a number in num Step 3: WHILE num >=1 REPEAT step 4, 5 Step 4: fact = fact * num Step 5: num = num – 1 Step 6: END WHILE Step 7: PRINT fact
Decomposition
- Decomposition means breaking down a complex problem into smaller sub problems to solve them conveniently and easily.
- Breaking down complex problem into sub problem also means analyzing each sub problem in detail.
- Decomposition also helps in reducing time and effort as different subprograms can be assigned to different experts in solving such problems.
- To get the complete solution, it is necessary to integrate the solution of all the sub problems once done.
Following image depicts the decomposition of a problem
2 thoughts on “Introduction to Problem Solving Class 11 Notes | CBSE Computer Science”
SO HELPFUL AND BEST NOTES ARE AVAILABLE TO GAIN KNOWLEDGE EASILY THANK YOU VERY VERY HEPFUL CONTENTS
THANK YOU SO MUCH FOR THE WONDERFUL NOTES
Leave a Comment Cancel Reply
Your email address will not be published. Required fields are marked *
Save my name, email, and website in this browser for the next time I comment.
IMAGES
VIDEO
COMMENTS
Computer science is similar to mathematics in that both are used as a means of defining and solving some problem. In fact, computer-based applications often use mathematical models as a basis for the manner in which they solve the problem at hand. In mathematics, a solution is often expressed in terms of formulas and equations. In
Programming for problem solving using C Notes Unit - I Computer History, Hardware, Software, Programming Languages and Algorithms: Components andfunctions of a Computer System, Concept of Hardware and Software Programming Languages: Low- level and High-level Languages, Program Design Tools: Algorithm, Flowchart, Pseudo code.
to apply problem solving techniques. Problem solving begins with the precise identification of the problem and ends with a complete working solution in terms of a program or software. Key steps required for solving a problem using a computer are shown in Figure 4.1 and are discussed in following subsections. 4.2.1 Analysing the problem
Solving Problems with Solutions Requiring Sequential Processing Overview Computer programming is not just programming language syntax and using a development environment. At its core, computer programming is solving problems. We will now turn our attention to a structured methodology you can use to construct solutions for a given problem.
2. Make a plan to solve the problem—use pictures, charts, graphs, systematic lists, objects, or act out the solution to help you devise a plan to solve the problem In Computer Science we call this plan an algorithm. 3. Carry out the plan—once the plan is conceived and understood, follow the plan. If you
3. Calculation: by moving beads on the abacus's spindles, the user can perform addition, subtraction, multiplication and division. • Modern computers contain powerful central processing units that perform calculations at astonishing speeds. 4. User Interface: the beads and spindles on the abacus.
n Notion of a "Java Virtual Machine" (JVM) n Java programs are compiled to run on a virtual machine (just a specification of a machine). This code is called Byte Code n Each physical machine that runs a Java program (byte code) must "pretend" to be a JVM. n This is achieved by running a program on the machine that implements the JVM and ...
Learning Outcomes Model a given problem computationally. Identify a solution to the problem. Decompose the solution into a sequence of logical steps. Implement the steps in a computer program. Solve the problem with the program. Iterate through the solution as required. ProblemProblem AApp pp rr ooaa cchAhAee ss IImmpp ll eemmee nAnAtt aa tt ii oAoAnn ss
Example problem: Step 1 - Identify the problem that must be solved. The first step is to identify the problem that needs to be solved. In this example, the largest number in the list must be found and displayed. Step 2 - Understand what the problem presents. The problem presents a list of numbers.
E-mail: [email protected] Fax: (+44) 1227 762811. ABSTRACT: This paper describes our experiences in devising a lightweight, informal methodology for problem solving in introductory, university level, computer science. We first describe the original context of the experiment and the background to the methodology.
1. Start with a small, human solvable version of the problem. 2. Look at your problem, looking to identify where you can use any of the 4 computational thinking prompts outlined above until you devise a solution. 3. Test your proposed solution on larger, real-world versions of the problem. 4. Adapt and repeat until your program is complete.
Computer is a very powerful tool for solving problems. It is a symbol-manipulating machine that follows a set of stored instructions called a program. It performs these manipulations very quickly and has memory for storing input, lists of commands and output. A computer cannot think in the way we associate with humans.
problem-solving Topic: 2.1.1 Problem-solving and design Understand and use assignment statements What is an Assignment? An assignment is an instruction in a program that places a value into a specified variable. Some typical assignments are: Note that the last example is a common method used to increment the value of a variable. It could be ...
3. Design the algorithm to solve the problem. Write the step-by-step procedures required to solve the problem. For large problems, don't attempt to solve every last detail of the problem at the beginning. Use a top-down design that is, list the major steps first and break down the problem into smaller and more manageable sub-problems. Once you
PROGRAMMING FOR PROBLEM SOLVING - MRCET
Algorithmic problem solving is the art of formulating efficient methods that solve problems of a mathematical nature. From the many numerical algo-rithms developed by the ancient Babylonians to the founding of graph theory by Euler, algorithmic problem solving has been a popular intellectual pursuit during the last few thousand years.
PROBLEM SOLVING TECHNIQUES Problem solving technique is a set of techniques that helps in providing logic for solving a problem. Problem solving can be expressed in the form of 1. Algorithms. 2. Flowcharts. 3. Pseudo codes. 4. Programs 1.ALGORITHM It is defined as a sequence of instructions that describe a method for solving a problem. In other ...
Step 1: Find the numbers (divisors) which can divide the given numbers. Step 2: Then find the largest common number from these two lists. A finite sequence of steps required to get the desired output is called an algorithm. Algorithm has a definite beginning and a definite end, and consists of a finite number of steps.
Health and Medicine : Computer technology is radically changing the tools of medicine. All medical information can now be digitized. Software is now able to computer the risk of a disease. Mental health researchers are using computers to screen troubled teenagers in need of psychotherapy.
Courses. Computer Science and Engineering. NOC:Problem Solving through Programming in C (Video) Syllabus. Co-ordinated by : IIT Kharagpur. Available from : 2017-12-21. Lec : 1.
Problem solving (with in the context of developing programs) refers to analyzing a problem with the intention of deriving a solution for the problem. Using computer's in problem solving. Software development method (SDM). Consists of the following steps:
In more general terms, problem solving is. part of a larger process that encompasses problem determination, de-. duplication, analysis, diagnosis, repair, and other steps. 3. Other problem solving ...
Steps for problem solving. There are 4 basic steps involved in problem solving. Analyze the problem. Developing an algorithm. Coding. Testing and debugging. Analyze the problem. Analyzing the problem is basically understanding a problem very clearly before finding its solution. Analyzing a problem involves.