[320] Graph Search
–
Assume this insertion order for a BST: 25, 24, 21, 4, 3, 2, 11 Draw the tree:
Review
Assume this insertion order for a BST: 25, 24, 21, 4, 3, 2, 11
Draw the tree: 25
Review
Assume this insertion order for a BST: 25, 24, 21, 4, 3, 2, 11 Draw the tree:
24
25
Review
Assume this insertion order for a BST: 25, 24, 21, 4, 3, 2, 11 Draw the tree:
24 21
25
Review
Assume this insertion order for a BST: 25, 24, 21, 4, 3, 2, 11 Draw the tree:
25
24 21
4
Review
Assume this insertion order for a BST: 25, 24, 21, 4, 3, 2, 11 Draw the tree:
25
24 21
4 3
Review
Assume this insertion order for a BST: 25, 24, 21, 4, 3, 2, 11 Draw the tree:
25
24 21
4 3
2
Review
Assume this insertion order for a BST: 25, 24, 21, 4, 3, 2, 11 Draw the tree:
25
24 21
3 2
4
11
Review
would have probably been more balanced if insert order randomized
Assume this insertion order for a BST: 25, 24, 21, 4, 3, 2, 11 Draw the tree:
25
24 21
3 2
4
11
Review
Assume this insertion order for a BST: 25, 24, 21, 4, 3, 2, 11 Draw the tree:
25
24 21
4 3
2
11
all values between 4 and 21
Review
Which nodes will be checked if we’re searching for 22? Draw the tree:
25
24 21
3 2
4
11
Review
Which nodes will be checked if we’re searching for 22? Draw the tree:
25
4
11
24 21
empty
3 2
Review
Write down an insertion order that will produce a balanced tree… Draw the tree:
11
24
2 4 21 25
3
Review
Write down an insertion order that will produce a balanced tree… Draw the tree:
11
24
2 4 21 25
11, 3, 24, 2, 4, 21, 25
3
Coding Demos Starter notebook on website…