26

Depth-First Search (DFS) Properties

  • Upload
    onella

  • View
    44

  • Download
    0

Embed Size (px)

DESCRIPTION

Depth-First Search (DFS) Properties. Non-optimal solution path Incomplete unless there is a depth bound Exponential time Linear space. BFS. Comments on Iterative Deepening Search. Complexity Space complexity = O( bd ) Time Complexity - PowerPoint PPT Presentation

Citation preview

Page 1: Depth-First Search (DFS) Properties
Page 2: Depth-First Search (DFS) Properties
Page 3: Depth-First Search (DFS) Properties
Page 4: Depth-First Search (DFS) Properties
Page 5: Depth-First Search (DFS) Properties

Depth-First Search (DFS) Properties

• Non-optimal solution path• Incomplete unless there is a depth bound• Exponential time• Linear space

Page 6: Depth-First Search (DFS) Properties
Page 7: Depth-First Search (DFS) Properties
Page 8: Depth-First Search (DFS) Properties

BFS

Page 9: Depth-First Search (DFS) Properties
Page 10: Depth-First Search (DFS) Properties

Comments on Iterative Deepening Search

• Complexity– Space complexity = O(bd)– Time Complexity

• = O(bd) (i.e., asymptotically the same as BFS or DFS in the the worst case)

• The overhead in repeated searching of the same subtrees is small relative to the overall time– e.g., for b=10, only takes about 11% more time than DFS

• A useful practical method– combines

• guarantee of finding an optimal solution if one exists (as in BFS)• space efficiency, O(bd) of DFS• But still has problems with loops like DFS

Page 11: Depth-First Search (DFS) Properties

12

Time requirements for depth-first iterative deepening on binary tree

Nodes at each level

1

2

4

8

16

32

64

128

Nodes searched by DFS

1

+2 = 3

+4 = 7

+8 = 15

+16 = 31

+32 = 63

+64 = 127

+128 = 255

Nodes searched by iterative DFS

1

+3 = 4

+7 = 11

+15 = 26

+31 = 57

+63 = 120

+127 = 247

+255 = 502

Page 12: Depth-First Search (DFS) Properties

Homework

Page 13: Depth-First Search (DFS) Properties
Page 14: Depth-First Search (DFS) Properties
Page 15: Depth-First Search (DFS) Properties
Page 16: Depth-First Search (DFS) Properties
Page 17: Depth-First Search (DFS) Properties
Page 18: Depth-First Search (DFS) Properties

Example

Page 19: Depth-First Search (DFS) Properties
Page 20: Depth-First Search (DFS) Properties
Page 21: Depth-First Search (DFS) Properties
Page 22: Depth-First Search (DFS) Properties
Page 23: Depth-First Search (DFS) Properties
Page 24: Depth-First Search (DFS) Properties
Page 25: Depth-First Search (DFS) Properties
Page 26: Depth-First Search (DFS) Properties