Entry: Computer Science Notes v.8 Monday, September 28, 2009



Chapter 6 Problem solving and Algorithm Design

Problem solving
-the act of finding a solution to a perplexing, distressing, vexing, or unsettled question.

How do you solve problems?
1) Understand the problem
2) devise a plan
...

Ask questions!
What do I know about the problem?
What is the information that I have to process in order to find..

Ask question! Never reinvent the wheel!
Similar problems come up again and again in different guises.

A good programmer recognizes a task or subtask that has been solved before and plugs in the solution.

Divide and Conquer!

Break up a large problem into smaller units and solve each smaller problem.
-Applies the concept of abstraction
-The divide-and-conquer approach can be applied over and over again until each subtask is manageable.

Algorithm
-A set of unambiguous instructions for solving a problem or subproblem in a finite amount of time using a finite amount of data.

Computer-Problem Solving
Analysis and Specification Phase
-Analyze
-Specification

Algorithm Decvelopment Phase
-Develop algorithm
-Test algorithm

Implementation Phase
-Code algorithm
-Test algorithm

Maintenance Phase
-Use
-Maintain

Pseudocode
-A mixture of English and formatting to make the steps in an algorithm explicit.
-Algorithm to Convert base -10 number to other bases.
[White the (the quotient is not zero).
Divide the decimal number by the new base...]

Two methodologies used to develop computer solutions to a problem
-Top-down design focuses on the tasks to be done
-Object-orientated design focuses on the data involved

Psuedocode
A way of expressing algorithms that uses a mixture of English phrases and indention to make the steps in the solution explicit.

Variables
-Names of places to store values

Assignment
-Storing the value of an expression into a variable

Output
-Printing a value on an output device

Input
-Getting values from the outside...

Repetition
-Repeating a series of statements.

Selection
-Making a choice to execute or skip a statement (or group of statements)


   0 comments

Leave a Comment:

Name


Homepage (optional)


Comments