- High School
- You don't have any recent items yet.
- You don't have any courses yet.
- You don't have any books yet.
- You don't have any Studylists yet.
- Information
1632064445 chapter-5-problem-solving-methodology
Bca 1st sem (1234), gulbarga university, recommended for you, students also viewed.
- 1632064484 chapter-7-introduction-to-c
- 1631295596 Chapter-6 Basic Concepts of OOP
- 1632063536 chapter-2-input-output-memory-device-Copy
- 1632076191 chapter-16-spreadsheet 1
- 1632068708 chapter-14-structures 1
- 1632064607 chapter-8-data-types
Related documents
- 1632065144 chapter-11-arrays 1
- Chapter-3 Logic Gates - Vaman kulkarni
- EVS unit 2 chapter notes
- Chapter 02-BCO - Suneeta mam
- Chapter 03-Number System
- View Institute Bond 2 - This is the UGCET-UGNEET 2024 First Round Real Final Seat Allotment Result,
Preview text
Chapter 5- Problem Solving Methodology I PUC,
1 | Dr. Ayesha Naaz
PROBLEM SOLVING METHODOLOGY
introduction.
The term problem solving is used in many disciplines, sometimes with different perspectives and often with different terminologies. The problem-solving process starts with the problem specification and end with a correct program. The steps to follow in the problem-solving process are: Problem definition Problem Analysis Algorithm development Coding Testing & Debugging Documentation & Maintenance The stages of analysis, design, programming, implementation and maintenance form the life cycle of the system.
Problem definition:
This step defines the problem thoroughly. Here requirements are specified. This step includes understanding the problem very well. The problem solver must understand problem very well to solve problem efficiently.
Problem Analysis:
Analyzing the problem or analysis involves identifying the following: Inputs, i. the data you have to work with. Outputs i. the desired results. Any additional requirements on the solutions.
ALGORITHM
An Algorithm is a step-by-step procedure to solve a given problem. The word algorithm originates from the word ‘algorism’ which means process of doing arithmetic with Arabic numerals.
In 9th-century Arab Mathematician, Mohammed Al-Khowarizmi, who developed methods for solving problems which is, used specific step-by-step instructions.
Characteristics of algorithm: A well defined algorithm has the five basic characteristics; as follows 1. Input: Algorithm starts with procedural steps to accept input data. The algorithm must accept one or more data to be processed. 2. Definite: Each operational step or operation must be definite i. each and every instruction must clearly specify that what should be done. 3. Effective: Each operational step can at least in principle is carried out by a person using a paper and pencil in a minimum number of times. 4. Terminate: After some minimum number operation algorithm must come to an end. 5. Output: An algorithm is written to solve the problem, therefore it must produce one or more computed result or answer called output.
Example: An algorithm to find the area of a rectangle can be expressed as follows: Given the length l and the breadth b, this algorithm finds the area of rectangle rec. Step 1: START Step 2: [Read the vales of l, b] INPUT l, b Step 3: [Calculate are of rectangle] rec = l * b Step 4: [Print the area of rectangle] OUTPUT rec Step 5: [End of Algorithm] STOP In the above example, we used = that represents assignment.
Design an algorithm to find the average of four numbers Step 1: START Step 2: INPUT A, B, C, D Step 3: [Calculate] AVG = (A+B+C+D)/ Step 4: OUTPUT AVG Step 5: STOP
Design an algorithm to find Fibonacci series ( N ) Step 1: START Step 2: INPUT N Step 3: [Initialize the variables] First = 0 Second = 1 Term = 2 Step 4: [Print the values of first and second] PRINT First, Second Step 5: Third = First + Second Step 6: Repeat while ( term <= N ) PRINT Third First = Second Second = Third Third = First + Second Term = Term + 1 [End of While loop] Step 7: STOP
Design an algorithm to find the GCD of two numbers ( A, B ) Step 1: START Step 2: INPUT A, B Step 3: Repeat while ( B != 0 ) Rem = A % B A = B B = Rem [End of While loop] Step 4: [Print the last divisor] PRINT A Ste 5: STOP
Advantage of Algorithm
- It is a step-by-step representation of a solution to a given problem, which is very easy to understand.
- It has got a definite procedure, which can be executed within a set period of time.
- It is independent of programming language.
- It is easy to debug as every step has got its own logical sequence.
Disadvantage of Algorithm It is time-consuming An algorithm is developed first which is converted into a flowchart and then into a computer program.
Analysis of Algorithm There may be more than one approach to solve a problem. The choice of a particular algorithm depends on the following performance analysis and measurements. o Space complexity: The amount of memory needed by the algorithm to complete its run. o Time Complexity: The amount of time, the algorithm needed to complete its run. When we analyze an algorithm depends on input data, there are three cases o Best Case o Average Case o Worst Case
FLOWCHART
A Flowchart is a pictorial or graphical representation of an algorithm. Flowchart plays an important role in the programming of a problem and helpful in understanding the logic of program. Once the flow chart is drawn, it becomes easy to write program in any high level language. Flowcharts are classified into two categories: 1. Program Flowcharts 2. System Flowcharts Program flowcharts present a diagrammatic representation of a sequence of instructions for solving a program. System flowcharts indicate the flow of data throughout a data processing system, as well as the flow into and out of the system. Such flowcharts are widely used by designers, to explain a data processing system.
Importance of Flowchart 1. Communication: Flowcharts are better way of communication of the logic of a program. 2. Effective Analysis: With the help of flowchart, problem can be analyzed in more effective way. 3. Proper documentation: Program flowcharts serve as a good program documentation, which is needed for various programs.
Step 3: [Calculate Area]
START START START
INPUT A, B INPUT rad INPUT s1, s2, s
OUTPUT A, OUTPUT area,
Temp = A; A = B; B = Temp; s = (s1 + s2 + s3)/2area = sqrt ( s * (s – s1) * (s – s2) * (s – s3))
OUTPUT area
Area = Side * Side Step 4: OUTPUT Area Step 5: STOP
Swap 2 Number area of Circle & Circumference Area of triangle
- Write a program, design a flow chart and an algorithm to find the larger of two numbers. Step 1: Start Step 2: Input A and B Step 3: If(A>B) then Output A Else Output B [End if] Step 4: Stop
area = 3 * rad * rad; circum = 2 * 3 * rad;
Testing and Debugging
Testing is the process of checking whether the program works according to the requirement of the user. Debugging is the process of identifying and correcting or removing the Bugs (errors). There are four types of errors. They are Syntax errors Run-time errors Semantic errors Logic errors (bugs)
Syntax Error Syntax is the set of rules which should followed while creating the statements of the program. The grammatical mistakes in the statements of the program are called syntax errors. Example: void main( ) { int a, b; cout << ‘Enter the numbers” ; cin >> a >> b; cout << a + b } In the example program, the fourth statement produces an syntax error as the missing semicolon.
Run-time Error During execution of the program, some errors may occur. Such errors are called run-time errors. Example: Divide by zero.
Semantic Error An error, which occurs due to improper use of statements in programming language. Consider an expression C = A + B, indicating the values of the variable A and B are added and assigned to variable C. If we written A + B = C, through the values of A and B are added, it cannot be assigned to variable C written to the right of = Sign. This is semantic error.
Logical Error Logical errors occur when there are mistakes in the logic of the program. Unlike other errors logical errors are not displayed while compiling because the compiler does not understand the logic of the program. Example: To find the area of the circle, the formula to be used is area = 3 * r * r. But if we written area = 3 * 2 * r, then the required output is not obtained even though the program is successfully executed.
Documentation and Maintenance
Documentation is a reference material which explains the use and maintenance of the program application for which it has been written. There are two types of documentation. o Internal Documentation o External Documentation.
Internal Documentation: This is also known as technical documentation. It is meant for the programmer who may update the program code at later stages. It is done by: o Defining meaningful variable names. o Including comments in program code. o Presenting the program code clearly.
External Documentation: The program or application is supported with additional textual information about the application. It is useful for the user, administrator or developer.
Maintenance:
Program maintenance means periodic review of the programs and modifications based on user’s requirements. Maintenance is a continuous task Documentation plays an important role in program maintenance. It helps speedy and efficient maintenance.
Simple - if : This structure helps to decide the execution of a particular statement based on a condition. This statement is also called as one-way branch. The general form of simple – if statement is: if (Test Condition) // This Condition is true Statement 1; Statement 2; Here, the test condition is tested which results in either a TRUE or FALSE value. If the result of the test condition is TRUE then the Statement 1 is executed. Otherwise, Statement 2 is executed. Ex: if( amount > = 5000 ) discount = amount * (10/100); net-amount = amount – discount;
if – else statement : This structure helps to decide whether a set of statements should be executed or another set of statements should be executed. This statement is also called as two-way branch. The general form of if – else statement is: if (Test Condition) Statement 1; else Statement 2; Here, the test condition is tested. If the test-condition is TRUE, statement-1 is executed. Otherwise Statement 2 is executed. Ex: if( amount > = 5000 ) discount = amount * (10/100); else discount = amount * (5/100);
if – else - if statement : This structure helps the programmer to decide the execution of a statement from multiple statements based on a condition. There will be more than one condition to test.
This statement is also called as multiple-way branch. The general form of if – else – if statement is: if (Test Condition 1) Statement 1; else if (Test Condition 2) Statement 2; else ........... else if( test Condition N) Statement N; else Default Statement Here, Condition 1 is tested. If it is TRUE, Statement 1 is executed control transferred out of the structure. Otherwise, Condition 2 is tested. If it is TRUE, Statement 2 is executed control is transferred out of the structure and so on. If none of the condition is satisfied, a statement called default statement is executed. Example: if( marks > = 85 ) PRINT “Distinction” else if( marks > = 60 ) PRINT “First Class” else if( marks > = 50 ) PRINT “Second Class” else if( marks > = 35 ) PRINT “Pass”
Nested if statement :
else PRINT “Fail”
The statement within the if statement is another if statement is called Nested – if statement. The general form of Nested – if statement is: if (Test Condition 1) if (Test Condition 2) else else
Case 3: PRINT “Tuesday”; Break; Case 4: PRINT “Wednesday”; Break; Case 5: PRINT “Thursday”; Break; Case 6: PRINT “Friday”; Break; Case 7: PRINT “Saturday”; Break; default: PRINT “Invalid Day Number”; }
Iterative Constructs or Looping The process of repeated execution of a sequence of statements until some condition is satisfied is called as iteration or repetition or loop. Iterative statements are also called as repetitive statement or looping statements. There are two iterative constructs, viz. o Conditional Looping o Unconditional Looping
Conditional Looping : This statement executes a group of instructions repeatedly until some logical condition is satisfied. The number of repetitions will not be known in advance. The two conditional looping constructs are: o While o do while
Unconditional Looping : This statement executes a group of instructions is repeated for specified number of times. The unconditional looping constructs is for statement.
While Constructs: This is a pre-tested loop structure. This structure checks the condition at the beginning of the structure. The set of statements are executed again and again until the condition is true. When the condition becomes false, control is transferred out of the structure. The general form of while structure is While ( Test Condition)
Statement 1 Statement 2 ........ Statement N End of While Example: i = 1; While ( i < = 5) PRINT i; i = i + 1; end of while Output: 1 2 3 4 5
do while Constructs: This is a post-tested loop structure. This structure checks the condition at the end of the structure. The set of statements are executed again and again until the condition is true. When the condition becomes false, control is transferred out of the structure. The general form of while structure is do Statement Statement ........ Statement N while ( Test Condition) End of While Example: sum = l; i = 1; do sum = sum + i; i = i + 1; while ( i < = 100);
Difference between while and do while loop: while do while This is pre- tested loop This is post tested loop Minimum execution of loop is zero Minimum execution of loop is once.
Approaches to problem solving:
- Top-down design: Top-down design involves dividing a problem into sub-problems and further dividing the sub- problems into smaller sub-problems until it leads to sub-problems that can be implemented as program statements.
Where A is the main problem and remaining are the sub-problems. The top-down approach is taken for program design; the programs can be developed easily, quickly, committing a minimum of errors.
- Stepwise refinement: The process of breaking down the problem at each stage to obtain a computer solution is called stepwise refinement.
- Bottom-up design: A design method, in which system details are developed first, followed by major process. This approach is the reverse of top-down design. The process starts with identification of set of modules which are either available or to be constructed. An attempt is made to combine the lower level modules to form modules of high level. Examples include object oriented programming using C++.
- Programming techniques: i. Unstructured programming: During learning stage by writing small and simple programs without planning leads to unstructured programming.
20 | Dr. Ayesha Naaz
ii. Procedural programming: This method allows us to combine the returning sequences of statements into one single place. A procedure call is used to invoke the procedure. After the sequence is processed, flow of control proceeds right after the position where the call was made. Procedures (sub procedures) programs can now be written as more structured and error free. iii. Structured programming: Structured programming is method of programming by using the following type of code structures to write program: o Sequence (input, output, assignment) o Selection (if, if-else etc.) o Iteration (while, do-while, for) o Subroutines (functions) iv. Modular programming: The process of splitting the lengthier and complex programs into number of smaller units (modules) is called modularization and programming with such an approach is called modular programmin. This technique provides grouping of procedures which are common functionality into separate modules. Advantages of modular programming: o Reusability o Debugging is easier o Building library o Portability CHAPTER 5– PROBLEM SOLVING METHODOLOGY BLUE PRINT VSA (1 marks) SA (2 marks) LA (3 Marks) Essay (5 Marks) Total 01 Question 01 Question 01 Question 01 Question 11 Marks
- Multiple Choice
Course : Bca 1st sem (1234)
University : gulbarga university.
- Discover more from: Bca 1st sem 1234 Gulbarga University 83 Documents Go to course
- More from: Bca 1st sem 1234 Gulbarga University 83 Documents Go to course
IMAGES
COMMENTS
Chapter 5-Problem Solving Methodology I PUC, MDRPUC, Hassan 5 | P a g e Disadvantage of Algorithm It is time-consuming An algorithm is developed first which is converted into a flowchart and then into a computer program. Analysis of Algorithm There may be more than one approach to solve a problem. The choice of a particular algorithm
information systems. A problem-solving methodology is discussed, with the emphasis on design and development. The content of this chapter leads students to an awareness of creating digital solutions using various techniques and procedures. At the completion of Chapters 4 and 5, students should be able to demonstrate Outcome 3, which requires
CHAPTER 5: PROBLEM SOLVING AND CREATIVITY 67 Teaching Engineering - Wankat & Oreovicz Cognitive psychologists are in general agreement that there are generalizable problem-solving skills, but that problem solving is also very dependent upon the knowledge required to solve the problem [see Chapter 14 and Kurfiss (1988) for a review].
Problem Solving Visit : python.mykvs.in for regular updates Problem Solving Cycle 2. Design Solution Designing an algorithm: An algorithm is a plan, a logical step-by-step process for solving a problem. Algorithms are normally written as a flowchart or in pseudo-code as it’snext level. When designing an algorithm there are two main areas to ...
Chapter 5- Problem Solving Methodology I PUC, 1 | Dr. Ayesha Naaz. Chapter-PROBLEM SOLVING METHODOLOGY Introduction The term problem solving is used in many disciplines, sometimes with different perspectives and often with different terminologies. The problem-solving process starts with the problem specification and end with a correct program. The steps to follow in the problem-solving process ...
Chapter 5 Problem Solving Methodology - Free download as PDF File (.pdf), Text File (.txt) or read online for free. The document describes the problem solving methodology which includes defining the problem, analyzing it, developing an algorithm, coding, testing, and documenting.
chapter-5-problem-solving-methodology - Free download as PDF File (.pdf), Text File (.txt) or read online for free. The document describes the problem solving methodology which includes defining the problem, analyzing it, developing an algorithm, coding, testing and debugging.
chapter-5-problem-solving-methodology - Free download as Word Doc (.doc / .docx), PDF File (.pdf), Text File (.txt) or read online for free.
5.Write an algorithm to convert temperature in Fahrenheit to Celsius. (U) 6.Write an algorithm to find largest among three numbers. (U) 7.Write an algorithm to find sum and average of three numbers. (U) 8.What is the importance of flowchart? (U) 9.Draw a flowchart to find the largest of three numbers. (S) 10.
Title: Microsoft PowerPoint - Chapter 5- Problem Solving Methodology-II.pptx Author: Sisir Created Date: 5/1/2020 2:51:39 PM