Problem Solving and Algorithm Design Problem Solving  Problem solving The act of finding a solution to a perplexing, distressing, vexing, or unsettled question. Problem Solving   G.

Download Report

Transcript Problem Solving and Algorithm Design Problem Solving  Problem solving The act of finding a solution to a perplexing, distressing, vexing, or unsettled question. Problem Solving   G.

Slide 1

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17


Slide 2

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17


Slide 3

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17


Slide 4

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17


Slide 5

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17


Slide 6

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17


Slide 7

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17


Slide 8

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17


Slide 9

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17


Slide 10

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17


Slide 11

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17


Slide 12

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17


Slide 13

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17


Slide 14

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17


Slide 15

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17


Slide 16

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17


Slide 17

Problem Solving
and Algorithm Design

Problem Solving


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

2

Problem Solving




G. Polya wrote How to Solve It: A New
Aspect of Mathematical Method
His “How to Solve It” list is quite general.




It’s written in the context of solving mathematical
problems.
With simple wording changes the list becomes
applicable to all types of problems.

3

Ask Questions...


…to understand the problem:


What do I know about the problem?



What is the information that I have to process in
order the find the solution?



What does the solution look like?



What sort of special cases exist?



How will I recognize that I have found
the solution?
4

Look for Familiar Things





You should never “reinvent the wheel”.
In computing, you see certain problems again
and again in different guises.
A good programmer sees a task,
or perhaps part of a task (a subtask),
that has been solved before and plugs
in the solution.

5

Divide and Conquer


Break up a large problem into smaller units
that can be handled more easily.


Abstraction plays an important role.



The divide-and-conquer approach can be applied
over and over again until each subtask is
manageable.

6

Abstraction

Abstraction - A mental model that removes
complex details.

This is a key concept. Abstraction will
reappear throughout the course – be sure you
understand it!

7

5

Algorithms




Algorithm:
A set of instructions for solving a problem or
subproblem in a finite amount of time using a
finite amount of data.
The instructions must be unambiguous.

8

Example of an Algorithm


Preparing a Hollandaise sauce:

9

Pseudocode


… uses a mixture of English and formatting to make
the steps in the solution explicit.

10

Developing an Algorithm




Since implementing the algorithm involves
making it computer-readable, the plan must
be in a suitable form.
The methodology (set of working methods)
used to make the plan must begin with a
problem statement and conclude with a
plan that can be easily coded.

11

Developing an Algorithm
Two methodologies are currently used, both
based on the divide-and-conquer strategy:



Top-down design




(functional decomposition)

Object-oriented design




(OOD)

12

Top-Down Design









… consists of breaking the problem into a set of subproblems
called modules.
It creates a hierarchical structure of problems and subproblems
(modules).
This process continues for as many levels as it takes to expand
every task to the smallest details.
A step that needs to be expanded is an abstract step.
A step that needs no more expansion is a concrete step.

13

Top-Down Design

Figure 6.5
An example
of top-down
design

14

Top-Down Design
1.
2.
3.

4.

Analyze the problem
Write the Main Module
Write the remaining modules
Re-sequence and Revise as necessary

15

Testing the Algorithm



The process itself must be tested.
Testing at the algorithm development phase
involves looking at each level of the top-down
design.

16

Testing the Algorithm






Desk checking: Working through a design at a
desk with a pencil and paper.
Walk-through: Manual simulation of the design by
the team members, taking sample data values and
simulating the design using the sample data.
Inspection: One person (not the designer) reads
the design (handed out in advance) line by line while
the others point out errors.

17