Presentation is loading. Please wait. # © Janice Regan 2004 1 Problem-Solving Process 1. State the Problem (Problem Specification) 2. Analyze the problem: outline solution requirements and design.

## Presentation on theme: "© Janice Regan 2004 1 Problem-Solving Process 1. State the Problem (Problem Specification) 2. Analyze the problem: outline solution requirements and design."— Presentation transcript:

© Janice Regan 2004 1 Problem-Solving Process 1. State the Problem (Problem Specification) 2. Analyze the problem: outline solution requirements and design an initial algorithm 3. Design and refine the algorithm to solve the problem, verify the algorithm, come up with a test plan 4. Implement the algorithm in a programming language (Java) and verify that the algorithm works 5. Maintain the program: use and modify if the problem domain changes 1. State the Problem (Problem Specification) 2. Analyze the problem: outline solution requirements and design an initial algorithm 3. Design and refine the algorithm to solve the problem, verify the algorithm, come up with a test plan 4. Implement the algorithm in a programming language (Java) and verify that the algorithm works 5. Maintain the program: use and modify if the problem domain changes

© Janice Regan 2004 2 Problem Specification  Any problem solving process consists of Input  Algorithm  Output  Determine what information is available as input to your algorithm  Determine what information is desired as output from your algorithm  Any problem solving process consists of Input  Algorithm  Output  Determine what information is available as input to your algorithm  Determine what information is desired as output from your algorithm

© Janice Regan 2004 3 Design a basic algorithm  An algorithm is  Any set of instructions that specifies a series of steps to correctly solve the problem  There may be many different algorithms to solve a given problem  Some algorithms may be more efficient than others  An algorithm is  Any set of instructions that specifies a series of steps to correctly solve the problem  There may be many different algorithms to solve a given problem  Some algorithms may be more efficient than others

© Janice Regan 2004 4 Properties of Good Algorithms  Efficiency  Simplicity  Precision  Effectiveness  Generality  Levels of Abstraction  Correctness  Finiteness  Maintainability  Efficiency  Simplicity  Precision  Effectiveness  Generality  Levels of Abstraction  Correctness  Finiteness  Maintainability

© Janice Regan 2004 5 Algorithms and Programs  An algorithm is a finite set of instructions that explains the required solution step-by-step  A computer can be instructed to implement many algorithms with a finite number of steps or instructions  A program is a set of computer instructions that implements an algorithm  An algorithm is a finite set of instructions that explains the required solution step-by-step  A computer can be instructed to implement many algorithms with a finite number of steps or instructions  A program is a set of computer instructions that implements an algorithm

© Janice Regan 2004 6 Refine the algorithm  Identify special cases  Determine how to test to demonstrate that the algorithm works for all cases (including special cases)  Verify that the algorithm is logically valid  The algorithm must give the correct answer, in a finite number of reproducible steps  The algorithm must terminate when the answer is determined  Identify special cases  Determine how to test to demonstrate that the algorithm works for all cases (including special cases)  Verify that the algorithm is logically valid  The algorithm must give the correct answer, in a finite number of reproducible steps  The algorithm must terminate when the answer is determined

© Janice Regan 2004 7 Implement the algorithm  Translate the algorithm into a programming language.  Make sure the implementation has correct syntax and semantics (it compiles)  Make sure the implementation is logically correct  Test and make sure the implementation works for all normal and special cases  Translate the algorithm into a programming language.  Make sure the implementation has correct syntax and semantics (it compiles)  Make sure the implementation is logically correct  Test and make sure the implementation works for all normal and special cases

© Janice Regan 2004 8 Problem-Analysis-Coding- Execution Cycle

© Janice Regan 2004 9 Class discussion  Algorithm for solving a quadratic equation

© Janice Regan 2004 10 Programming Methodologies  Two basic approaches to programming design:  Structured design (process oriented)  Centered on ‘What is happening’  Code (procedures) acting on data  Think in terms of breaking into tasks to be completed  Object-oriented design  Centered on ‘Who or what data is being affected’  Data controlling access to code  Think in terms of data entities, interfaces to that data, and processes or methods applied to that data  Two basic approaches to programming design:  Structured design (process oriented)  Centered on ‘What is happening’  Code (procedures) acting on data  Think in terms of breaking into tasks to be completed  Object-oriented design  Centered on ‘Who or what data is being affected’  Data controlling access to code  Think in terms of data entities, interfaces to that data, and processes or methods applied to that data

© Janice Regan 2004 11 Structured Design 1. A problem is divided into smaller subproblems 2. Each subproblem is solved 3. The solutions of all subproblems are then combined to solve the problem 1. A problem is divided into smaller subproblems 2. Each subproblem is solved 3. The solutions of all subproblems are then combined to solve the problem

© Janice Regan 2004 12 Object-Oriented Design (OOD)  In OOD, a program is a collection of interacting objects  An object consists of data and operations  Steps in OOD: 1. Identify objects 2. Form the basis of the solution 3. Determine how these objects interact  In OOD, a program is a collection of interacting objects  An object consists of data and operations  Steps in OOD: 1. Identify objects 2. Form the basis of the solution 3. Determine how these objects interact

Download ppt "© Janice Regan 2004 1 Problem-Solving Process 1. State the Problem (Problem Specification) 2. Analyze the problem: outline solution requirements and design."

Similar presentations

Ads by Google