Chapter 10: Algorithm Design Techniques - PowerPoint PPT Presentation

1 / 7
About This Presentation
Title:

Chapter 10: Algorithm Design Techniques

Description:

Mark Allen Weiss: Data Structures and Algorithm Analysis in Java Chapter 10: Algorithm Design Techniques Backtracking Lydia Sinapova, Simpson College – PowerPoint PPT presentation

Number of Views:176
Avg rating:3.0/5.0
Slides: 8
Provided by: ValuedGa633
Category:

less

Transcript and Presenter's Notes

Title: Chapter 10: Algorithm Design Techniques


1
Chapter 10 Algorithm Design Techniques
Mark Allen Weiss Data Structures and Algorithm
Analysis in Java
  • Backtracking

Lydia Sinapova, Simpson College
2
Backtracking
  • How to solve a problem by search
  • Generate and Test
  • What is Backtracking
  • Example

3
The Idea
Problem solving search in a space of possible
states.
4
Generate and Test Method
  • Take a state
  • Generate next states by applying relevant rules
  • (not all rules are applicable for a given
    state!)
  • Test to see if the goal state is reached.
  • If yes - stop
  •   If no - add the generated states into a
    stack/queue (do not add if the state has already
    been generated) and repeat the procedure.
  • To get the solution Record the paths

5
Search Methods
  • Breadth-first vs depth-first search
  • Exhaustive search (brute force) vs informative
    (constraint-based, heuristic) search
  • Backtracking

6
Backtracking
  • rejecting the currently reached state as a
    dead-end state,
  • going back to some previous level in the
    state-space tree/graph
  • proceeding with the exploration of other paths
    toward the target state
  • Backtracking occurs in depth-first search

7
Example
Replace the letters with distinct digits such
that the addition is correct
Decide on State representation Operators
Constraints Initial state Target state
  LOAN LOAN LOAN
LOAN ------- DEBT
Write a Comment
User Comments (0)
About PowerShow.com