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
Related Posts
18.what is missing data 19. why is missing data filled in dataframe with some value 20. name the function you can use for filling missing data 21. name some function to handle missing data., 2. what will be the output of the following code 2. select concat (concat(‘inform’, ‘atics’), ‘practices’); 3. select lcase (’informatics practices class 11th‘); 4. select ucase (’computer studies‘); 5. select concat (lower (‘class’), upper (‘xii’));, 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.