Problem Solving & Algorithm Design 01-1 Problem solving The - - PowerPoint PPT Presentation

problem solving algorithm design
SMART_READER_LITE
LIVE PREVIEW

Problem Solving & Algorithm Design 01-1 Problem solving The - - PowerPoint PPT Presentation

Problem Solving & Algorithm Design 01-1 Problem solving The act of finding a solution to a perplexing, distressing, vexing, or unsettled question 01-2 How to Solve it Written by George Polya in 1945 01-3 How to Solve it


slide-1
SLIDE 1

01-1

Problem Solving & Algorithm Design

slide-2
SLIDE 2

01-2

Problem solving

  • The act of finding a solution to a perplexing,

distressing, vexing, or unsettled question

slide-3
SLIDE 3

01-3

How to Solve it

  • Written by George Polya in 1945
slide-4
SLIDE 4

01-4

How to Solve it

  • Written by George Polya in 1945

» It is written in a mathematical context for

mathematical problems

slide-5
SLIDE 5

01-5

How to Solve it

  • Written by George Polya in 1945

» It is written in a mathematical context for

mathematical problems

> With simple wording changes his list of

suggestions are applicable to all types

  • f problems
slide-6
SLIDE 6

01-6

Ask Questions

  • To understand a problem
slide-7
SLIDE 7

01-7

Ask Questions

  • To understand a problem

» What do I know about the problem?

slide-8
SLIDE 8

01-8

Ask Questions

  • To understand a problem

» What do I know about the problem?

» What is the information that I have to

process in order to find the solution?

slide-9
SLIDE 9

01-9

Ask Questions

  • To understand a problem

» What do I know about the problem? » What is the information that I have to process in

  • rder to find the solution?

» What does the solution look like?

slide-10
SLIDE 10

01-10

Ask Questions

  • To understand a problem

» What do I know about the problem? » What is the information that I have to process in

  • rder to find the solution?

» What does the solution look like?

» What sort of special cases exist?

slide-11
SLIDE 11

01-11

Ask Questions

  • To understand a problem

» What do I know about the problem? » What is the information that I have to process in

  • rder to 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?

slide-12
SLIDE 12

01-12

Look for Familiar Things

» You should never “reinvent the wheel”

slide-13
SLIDE 13

01-13

Look for Familiar Things

» You should never “reinvent the wheel”

» In computing, you see certain problems

again in different guises

slide-14
SLIDE 14

01-14

Look for Familiar Things

» You should never “reinvent the wheel” » In computing, you see certain problems again in

different guises

» A good programmer sees a task, or

perhaps part of a task (subtask), that has been solved before and plugs in the solution.

slide-15
SLIDE 15

01-15

Divide and conquer

» Break up a large problem into smaller units

that can be handled more easily

slide-16
SLIDE 16

01-16

Divide and conquer

» Break up a large problem into smaller units that

can be handled more easily

» Abstraction plays an important role

slide-17
SLIDE 17

01-17

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

slide-18
SLIDE 18

01-18

Abstraction

An explanation, idea or model that
 removes complex details This is a key concept Abstraction will reappear
 throughout the course

slide-19
SLIDE 19

01-19

Algorithm

A technical term for a set of instructions for solving a problem or sub-problem

slide-20
SLIDE 20

01-20

Algorithm

A technical term for a set of instructions for solving a problem or sub-problem Desirable Properties Use a finite amount of time

slide-21
SLIDE 21

01-21

Algorithm

A technical term for a set of instructions for solving a problem or sub-problem Desirable Properties Use a finite amount of time Use a finite amount of data, material

slide-22
SLIDE 22

01-22

Algorithm

A technical term for a set of instructions for solving a problem or sub-problem Desirable Properties Use a finite amount of time Use a finite amount of data, material Instructions are unambiguous

slide-23
SLIDE 23

01-23

Who writes algorithms?

slide-24
SLIDE 24

01-24

Who writes algorithms?

Anyone who wants to write a set of instructions for solving a problem

slide-25
SLIDE 25

01-25

An Example Algorithm

How to prepare Hollandaise sauce

slide-26
SLIDE 26

01-26

Algorithm Written in Pseudocode

A mixture of English and formatting to make the steps in the algorithm explicit

Put butter in a pot
 Turn on burner (low heat)
 Put pot on the burner
 While (not bubbling)
 Leave pot on the burner
 Turn off burner
 Put other ingredients in the blender
 Turn on blender
 While (more butter needed)
 Pour butter into blender in a slow stream
 Turn off blender

slide-27
SLIDE 27

01-27

Developing an Algorithm

  • Implementing an algorithm involves making

it computer-readable

slide-28
SLIDE 28

01-28

Developing an Algorithm

  • Implementing an algorithm involves making

it computer-readable

» Must be in a suitable form for a computer

slide-29
SLIDE 29

01-29

Developing an Algorithm

  • Implementing an algorithm involves making

it computer-readable

» Must be in a suitable form for a computer

  • The methodology (set of working methods)

used to make the plan must

slide-30
SLIDE 30

01-30

Developing an Algorithm

  • Implementing an algorithm involves making

it computer-readable

» Must be in a suitable form for a computer

  • The methodology (set of working methods)

used to make the plan must

» Begin with a problem statement

slide-31
SLIDE 31

01-31

Developing an Algorithm

  • Implementing an algorithm involves making

it computer-readable

» Must be in a suitable form for a computer

  • The methodology (set of working methods)

used to make the plan must

» Begin with a problem statement » Conclude with a plan that can be easily

coded