/
Problem Decomposition Problem Decomposition

Problem Decomposition - PowerPoint Presentation

alexa-scheidler
alexa-scheidler . @alexa-scheidler
Follow
393 views
Uploaded On 2016-09-01

Problem Decomposition - PPT Presentation

and Abstraction Problem Solving Which one is easier Solving one big problem or Solving a number of small problems Problem Solving Which one is easier Solving one big problem or Solving a number of small problems ID: 458644

problems problem solving move problem problems move solving check small decompose decomposition abstraction decide winner board easier top smaller solve players number

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Problem Decomposition" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Problem Decomposition

and AbstractionSlide2

Problem Solving

Which one is easier:

Solving one big problem, or

Solving a number of small problems?Slide3

Problem Solving

Which one is easier:

Solving one big problem, or

Solving a number of small problems?

What are the advantages of

small

problems?Slide4

Problem Solving

Which one is easier:

Solving one big problem, or

Solving a number of

small

problems?

What are the advantages of small problems?

Easier to solve

Easier to ensure the solution is correct

In order to

have a number of small problems

What do we need to do first?Slide5

Common Mistake

Dive into the details

(e.g. at the level of

J

ava instructions)

Do not consider decomposing

the problem

first

in English”

Slide6

Tic-tac-toe

We would like to build a tic-tac-toe game that a human can play against

another

How

would you decompose the problem?Slide7

Problem Decomposition

Display the board

Make a move

Decide

winner

Can these smaller problems be independently

solved?

t

ested?Slide8

Decide Winner

Seems to be complicated, what can we do?Slide9

Decide Winner

Seems to be complicated, what can we do?

Decompose!Slide10

Decide Winner

Seems to be complicated, what can we do?

Decompose!

Check 3 rows

Check 3 columns

Check 2

diagonals

Can they be independently

Solved?

Tested?Slide11

Top-down

Decomposition

Display the board

Make a move

Decide winner

Check 3 rows

Check

3

columns

Check 2 diagonalsSlide12

Make a Move

Decompose:Slide13

Make a Move

Decompose:

Ask for a move

Update the boardSlide14

Top-down

Decomposition

Display the board

Make a

move

Ask for a move

Update the board

Decide winner

Check 3 rows

Check

3

columns

Check 2 diagonals

Two levels of abstractionSlide15

When to stop decomposing a problem?Slide16

When to

stop decomposing a problem

?

Until you’re confident you can solve the smaller problems correctly

Different for different peopleSlide17

Make a Move

Recall there are two human players

Who makes a move?Slide18

Make a Move

Do we want

To break it down to

2 smaller problems, each for a player

One problem that is

flexible for the 2 players

?Slide19

Make a Move

Do we want

To break it down to

2 smaller problems, each for a player

One problem that is

flexible for the 2 players

Prefer

one problem that is flexible for

2

situations

The 2 smaller problems are very similar

Solving 2 similar problems is tedious

Rewriting almost the same instructionsSlide20

Make a Move

makeAMove

(player)

Similar to

sqrt

(x)

makeAMove

can be used with different players

Problem abstraction

via parametersSlide21

Summary

Problem decomposition

Top-down

Decompose until you’re confident you can solve the small problems correctly.Slide22

Summary

Problem decomposition

Top-down

Decompose until you’re confident you can solve the small problems correctly.

Problem abstraction

Different

levels of

abstraction in top-down decomposition

More general to more specific

Increase abstraction via parameters

Allow the solution to be reused in different situations

Avoid repeatedly writing almost the

same instructions