61A Lecture 21 Announcements Binary Trees Binary Tree Class 4 - - PowerPoint PPT Presentation

61a lecture 21 announcements binary trees binary tree
SMART_READER_LITE
LIVE PREVIEW

61A Lecture 21 Announcements Binary Trees Binary Tree Class 4 - - PowerPoint PPT Presentation

61A Lecture 21 Announcements Binary Trees Binary Tree Class 4 Binary Tree Class class BTree(Tree): 4 Binary Tree Class A binary tree is a tree that has class BTree(Tree): a left branch and a right branch 4 Binary Tree Class A binary


slide-1
SLIDE 1

61A Lecture 21

slide-2
SLIDE 2

Announcements

slide-3
SLIDE 3

Binary Trees

slide-4
SLIDE 4

Binary Tree Class

4

slide-5
SLIDE 5

Binary Tree Class

4

class BTree(Tree):

slide-6
SLIDE 6

Binary Tree Class

A binary tree is a tree that has a left branch and a right branch

4

class BTree(Tree):

slide-7
SLIDE 7

Binary Tree Class

A binary tree is a tree that has a left branch and a right branch

4

7 3 1 5 9 11 class BTree(Tree):

slide-8
SLIDE 8

Binary Tree Class

A binary tree is a tree that has a left branch and a right branch Idea: Fill the place of a missing left branch with an empty tree

4

7 3 1 5 9 11 class BTree(Tree):

slide-9
SLIDE 9

Binary Tree Class

A binary tree is a tree that has a left branch and a right branch Idea: Fill the place of a missing left branch with an empty tree

4

7 3 1 5 9 11

E

class BTree(Tree):

slide-10
SLIDE 10

Binary Tree Class

A binary tree is a tree that has a left branch and a right branch Idea: Fill the place of a missing left branch with an empty tree

4

7 3 1 5 9 11

E E: An empty tree

class BTree(Tree):

slide-11
SLIDE 11

Binary Tree Class

A binary tree is a tree that has a left branch and a right branch Idea: Fill the place of a missing left branch with an empty tree

4

7 3 1 5 9 11

E E: An empty tree

class BTree(Tree): empty = Tree(None)

slide-12
SLIDE 12

Binary Tree Class

A binary tree is a tree that has a left branch and a right branch Idea: Fill the place of a missing left branch with an empty tree Idea 2: An instance of BTree always has exactly two branches

4

7 3 1 5 9 11

E E: An empty tree

class BTree(Tree): empty = Tree(None)

slide-13
SLIDE 13

Binary Tree Class

A binary tree is a tree that has a left branch and a right branch Idea: Fill the place of a missing left branch with an empty tree Idea 2: An instance of BTree always has exactly two branches

4

7 3 1 5 9 11

E E: An empty tree E E E E E E

class BTree(Tree): empty = Tree(None)

slide-14
SLIDE 14

Binary Tree Class

A binary tree is a tree that has a left branch and a right branch Idea: Fill the place of a missing left branch with an empty tree Idea 2: An instance of BTree always has exactly two branches

4

7 3 1 5 9 11

E E: An empty tree E E E E E E

class BTree(Tree): empty = Tree(None) def __init__(self, root, left=empty, right=empty): Tree.__init__(self, root, [left, right])

slide-15
SLIDE 15

Binary Tree Class

A binary tree is a tree that has a left branch and a right branch Idea: Fill the place of a missing left branch with an empty tree Idea 2: An instance of BTree always has exactly two branches

4

7 3 1 5 9 11

E E: An empty tree E E E E E E

class BTree(Tree): empty = Tree(None) def __init__(self, root, left=empty, right=empty): Tree.__init__(self, root, [left, right]) @property def left(self): return self.branches[0]

slide-16
SLIDE 16

Binary Tree Class

A binary tree is a tree that has a left branch and a right branch Idea: Fill the place of a missing left branch with an empty tree Idea 2: An instance of BTree always has exactly two branches

4

7 3 1 5 9 11

E E: An empty tree E E E E E E

class BTree(Tree): empty = Tree(None) def __init__(self, root, left=empty, right=empty): Tree.__init__(self, root, [left, right]) @property def left(self): return self.branches[0] @property def right(self): return self.branches[1]

slide-17
SLIDE 17

Binary Tree Class

A binary tree is a tree that has a left branch and a right branch Idea: Fill the place of a missing left branch with an empty tree Idea 2: An instance of BTree always has exactly two branches

4

7 3 1 5 9 11

E E: An empty tree E E E E E E

class BTree(Tree): empty = Tree(None) def __init__(self, root, left=empty, right=empty): Tree.__init__(self, root, [left, right]) @property def left(self): return self.branches[0] @property def right(self): return self.branches[1] t = BTree(3, BTree(1), BTree(7, BTree(5), BTree(9, BTree.empty, BTree(11))))

slide-18
SLIDE 18

Binary Tree Class

A binary tree is a tree that has a left branch and a right branch Idea: Fill the place of a missing left branch with an empty tree Idea 2: An instance of BTree always has exactly two branches

4

7 3 1 5 9 11

E E: An empty tree E E E E E E

class BTree(Tree): empty = Tree(None) def __init__(self, root, left=empty, right=empty): Tree.__init__(self, root, [left, right]) @property def left(self): return self.branches[0] @property def right(self): return self.branches[1] t = BTree(3, BTree(1), BTree(7, BTree(5), BTree(9, BTree.empty, BTree(11)))) (Demo)

slide-19
SLIDE 19

Binary Search Trees

slide-20
SLIDE 20

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

slide-21
SLIDE 21

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

[1, 2, 4, 8, 16, 32, 64] 20 in

slide-22
SLIDE 22

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

[1, 2, 4, 8, 16, 32, 64] 20 in

slide-23
SLIDE 23

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

[1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] 20 in

slide-24
SLIDE 24

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

[1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] 20 in

slide-25
SLIDE 25

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

[1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] 20 in

slide-26
SLIDE 26

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

[1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] 20 in

slide-27
SLIDE 27

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

[1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] 20 in False

slide-28
SLIDE 28

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

[1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] 20 in False [1, 2, 4, 8, 16, 32] 4 in

slide-29
SLIDE 29

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

[1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] 20 in False [1, 2, 4, 8, 16, 32] 4 in

slide-30
SLIDE 30

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

[1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] 20 in False [1, 2, 4, 8, 16, 32] [1, 2, 4, 8, 16, 32] 4 in

slide-31
SLIDE 31

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

[1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] 20 in False [1, 2, 4, 8, 16, 32] [1, 2, 4, 8, 16, 32] 4 in

slide-32
SLIDE 32

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

[1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] 20 in False [1, 2, 4, 8, 16, 32] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32] 4 in

slide-33
SLIDE 33

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

[1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] 20 in False [1, 2, 4, 8, 16, 32] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32] 4 in

slide-34
SLIDE 34

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

[1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] 20 in False [1, 2, 4, 8, 16, 32] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32] 4 in True

slide-35
SLIDE 35

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

[1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] 20 in False [1, 2, 4, 8, 16, 32] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32] 4 in True

For a sorted list of length n, what Theta expression describes the time required?

slide-36
SLIDE 36

Binary Search

A strategy for finding a value in a sorted list: check the middle and eliminate half

6

[1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32, 64] 20 in False [1, 2, 4, 8, 16, 32] [1, 2, 4, 8, 16, 32, 64] [1, 2, 4, 8, 16, 32] 4 in True

For a sorted list of length n, what Theta expression describes the time required? Θ(log n)

slide-37
SLIDE 37

Binary Search Trees

7

slide-38
SLIDE 38

Binary Search Trees

A binary search tree is a binary tree where each root value is:

7

slide-39
SLIDE 39

Binary Search Trees

A binary search tree is a binary tree where each root value is:

  • Larger than all entries in its left branch and

7

slide-40
SLIDE 40

Binary Search Trees

A binary search tree is a binary tree where each root value is:

  • Larger than all entries in its left branch and
  • Smaller than all entries in its right branch

7

slide-41
SLIDE 41

Binary Search Trees

A binary search tree is a binary tree where each root value is:

  • Larger than all entries in its left branch and
  • Smaller than all entries in its right branch

7 3 1 5 9 11

7

slide-42
SLIDE 42

Binary Search Trees

A binary search tree is a binary tree where each root value is:

  • Larger than all entries in its left branch and
  • Smaller than all entries in its right branch

7 3 1 5 9 11 7 3 1 5 9 11

7

slide-43
SLIDE 43

Binary Search Trees

A binary search tree is a binary tree where each root value is:

  • Larger than all entries in its left branch and
  • Smaller than all entries in its right branch

7 3 1 5 9 11 7 3 1 5 9 11 5 3 1 7 9 11

7

slide-44
SLIDE 44

Binary Search Trees

A binary search tree is a binary tree where each root value is:

  • Larger than all entries in its left branch and
  • Smaller than all entries in its right branch

7 3 1 5 9 11 7 3 1 5 9 11 5 3 1 7 9 11

7

(Demo)

slide-45
SLIDE 45

Discussion Questions

What's the largest element in a binary search tree?

8

slide-46
SLIDE 46

Discussion Questions

What's the largest element in a binary search tree?

8

def largest(t): if _________________________: return _________________ else: return _________________

slide-47
SLIDE 47

Discussion Questions

What's the largest element in a binary search tree?

8

def largest(t): if _________________________: return _________________ else: return _________________ 5 3 1 7 9 11

slide-48
SLIDE 48

Discussion Questions

What's the largest element in a binary search tree?

8

def largest(t): if _________________________: return _________________ else: return _________________ 5 3 1 7 9 11 5 3 1 7 9 8

slide-49
SLIDE 49

Discussion Questions

What's the largest element in a binary search tree?

8

def largest(t): if _________________________: return _________________ else: return _________________ t.right is BTree.empty t.root 5 3 1 7 9 11 5 3 1 7 9 8

slide-50
SLIDE 50

Discussion Questions

What's the largest element in a binary search tree?

8

def largest(t): if _________________________: return _________________ else: return _________________ t.right is BTree.empty t.root largest(t.right) 5 3 1 7 9 11 5 3 1 7 9 8

slide-51
SLIDE 51

Discussion Questions

What's the largest element in a binary search tree?

8

def largest(t): if _________________________: return _________________ else: return _________________ What's the second largest element in a binary search tree? t.right is BTree.empty t.root largest(t.right) 5 3 1 7 9 11 5 3 1 7 9 8

slide-52
SLIDE 52

Discussion Questions

What's the largest element in a binary search tree?

8

def largest(t): if _________________________: return _________________ else: return _________________ What's the second largest element in a binary search tree? def second(t): if t.is_leaf(): return None elif _______________________: return t.root elif _______________________: return _________________ else: return _________________ t.right is BTree.empty t.root largest(t.right) 5 3 1 7 9 11 5 3 1 7 9 8

slide-53
SLIDE 53

Discussion Questions

What's the largest element in a binary search tree?

8

def largest(t): if _________________________: return _________________ else: return _________________ What's the second largest element in a binary search tree? def second(t): if t.is_leaf(): return None elif _______________________: return t.root elif _______________________: return _________________ else: return _________________ t.right is BTree.empty t.root largest(t.right) 5 3 1 7 9 11 5 3 1 7 9 8

slide-54
SLIDE 54

Discussion Questions

What's the largest element in a binary search tree?

8

def largest(t): if _________________________: return _________________ else: return _________________ What's the second largest element in a binary search tree? def second(t): if t.is_leaf(): return None elif _______________________: return t.root elif _______________________: return _________________ else: return _________________ t.right is BTree.empty t.root largest(t.right) 5 3 1 7 9 11 5 3 1 7 9 8

slide-55
SLIDE 55

Discussion Questions

What's the largest element in a binary search tree?

8

def largest(t): if _________________________: return _________________ else: return _________________ What's the second largest element in a binary search tree? def second(t): if t.is_leaf(): return None elif _______________________: return t.root elif _______________________: return _________________ else: return _________________ t.right is BTree.empty t.root largest(t.right) 5 3 1 7 9 11 5 3 1 7 9 8

slide-56
SLIDE 56

Discussion Questions

What's the largest element in a binary search tree?

8

def largest(t): if _________________________: return _________________ else: return _________________ What's the second largest element in a binary search tree? def second(t): if t.is_leaf(): return None elif _______________________: return t.root elif _______________________: return _________________ else: return _________________ t.right is BTree.empty t.root largest(t.right) 5 3 1 7 9 11 5 3 1 7 9 8

slide-57
SLIDE 57

Discussion Questions

What's the largest element in a binary search tree?

8

def largest(t): if _________________________: return _________________ else: return _________________ What's the second largest element in a binary search tree? def second(t): if t.is_leaf(): return None elif _______________________: return t.root elif _______________________: return _________________ else: return _________________ t.right is BTree.empty t.root largest(t.right) 5 3 1 7 9 11 5 3 1 7 9 8 t.right.is_leaf()

slide-58
SLIDE 58

Discussion Questions

What's the largest element in a binary search tree?

8

def largest(t): if _________________________: return _________________ else: return _________________ What's the second largest element in a binary search tree? def second(t): if t.is_leaf(): return None elif _______________________: return t.root elif _______________________: return _________________ else: return _________________ t.right is BTree.empty t.root largest(t.right) 5 3 1 7 9 11 5 3 1 7 9 8 t.right is BTree.empty t.right.is_leaf()

slide-59
SLIDE 59

Discussion Questions

What's the largest element in a binary search tree?

8

def largest(t): if _________________________: return _________________ else: return _________________ What's the second largest element in a binary search tree? def second(t): if t.is_leaf(): return None elif _______________________: return t.root elif _______________________: return _________________ else: return _________________ t.right is BTree.empty t.root largest(t.right) 5 3 1 7 9 11 5 3 1 7 9 8 t.right is BTree.empty largest(t.left) t.right.is_leaf()

slide-60
SLIDE 60

Discussion Questions

What's the largest element in a binary search tree?

8

def largest(t): if _________________________: return _________________ else: return _________________ What's the second largest element in a binary search tree? def second(t): if t.is_leaf(): return None elif _______________________: return t.root elif _______________________: return _________________ else: return _________________ t.right is BTree.empty t.root largest(t.right) 5 3 1 7 9 11 5 3 1 7 9 8 t.right is BTree.empty largest(t.left) t.right.is_leaf() second(t.right)

slide-61
SLIDE 61

Sets as Binary Search Trees

slide-62
SLIDE 62

Membership in Binary Search Trees

10

slide-63
SLIDE 63

Membership in Binary Search Trees

contains traverses the tree

10

slide-64
SLIDE 64

Membership in Binary Search Trees

contains traverses the tree

  • If the element is not the root, it can only be in either the left or right branch

10

slide-65
SLIDE 65

Membership in Binary Search Trees

contains traverses the tree

  • If the element is not the root, it can only be in either the left or right branch
  • By focusing on one branch, we reduce the set by the size of the other branch

10

slide-66
SLIDE 66

Membership in Binary Search Trees

contains traverses the tree

  • If the element is not the root, it can only be in either the left or right branch
  • By focusing on one branch, we reduce the set by the size of the other branch

5 3 1 7 9 11

10

slide-67
SLIDE 67

Membership in Binary Search Trees

contains traverses the tree

  • If the element is not the root, it can only be in either the left or right branch
  • By focusing on one branch, we reduce the set by the size of the other branch

5 3 1 7 9 11 9

10

slide-68
SLIDE 68

Membership in Binary Search Trees

contains traverses the tree

  • If the element is not the root, it can only be in either the left or right branch
  • By focusing on one branch, we reduce the set by the size of the other branch

5 3 1 7 9 11 def contains(s, v): 9

10

slide-69
SLIDE 69

Membership in Binary Search Trees

contains traverses the tree

  • If the element is not the root, it can only be in either the left or right branch
  • By focusing on one branch, we reduce the set by the size of the other branch

5 3 1 7 9 11 def contains(s, v): if s is BTree.empty: return False 9

10

slide-70
SLIDE 70

Membership in Binary Search Trees

contains traverses the tree

  • If the element is not the root, it can only be in either the left or right branch
  • By focusing on one branch, we reduce the set by the size of the other branch

5 3 1 7 9 11 def contains(s, v): if s is BTree.empty: return False elif s.root == v: return True 9

10

slide-71
SLIDE 71

Membership in Binary Search Trees

contains traverses the tree

  • If the element is not the root, it can only be in either the left or right branch
  • By focusing on one branch, we reduce the set by the size of the other branch

5 3 1 7 9 11 def contains(s, v): if s is BTree.empty: return False elif s.root == v: return True elif s.root < v: return contains(s.right, v) 9

10

slide-72
SLIDE 72

Membership in Binary Search Trees

contains traverses the tree

  • If the element is not the root, it can only be in either the left or right branch
  • By focusing on one branch, we reduce the set by the size of the other branch

5 3 1 7 9 11 def contains(s, v): if s is BTree.empty: return False elif s.root == v: return True elif s.root < v: return contains(s.right, v) 9 If 9 is in the set, it is in this branch

10

slide-73
SLIDE 73

Membership in Binary Search Trees

contains traverses the tree

  • If the element is not the root, it can only be in either the left or right branch
  • By focusing on one branch, we reduce the set by the size of the other branch

5 3 1 7 9 11 def contains(s, v): if s is BTree.empty: return False elif s.root == v: return True elif s.root < v: return contains(s.right, v) elif s.root > v: return contains(s.left, v) 9 If 9 is in the set, it is in this branch

10

slide-74
SLIDE 74

Membership in Binary Search Trees

contains traverses the tree

  • If the element is not the root, it can only be in either the left or right branch
  • By focusing on one branch, we reduce the set by the size of the other branch

5 3 1 7 9 11 def contains(s, v): if s is BTree.empty: return False elif s.root == v: return True elif s.root < v: return contains(s.right, v) elif s.root > v: return contains(s.left, v) 9 If 9 is in the set, it is in this branch Order of growth?

10

slide-75
SLIDE 75

Membership in Binary Search Trees

contains traverses the tree

  • If the element is not the root, it can only be in either the left or right branch
  • By focusing on one branch, we reduce the set by the size of the other branch

5 3 1 7 9 11 def contains(s, v): if s is BTree.empty: return False elif s.root == v: return True elif s.root < v: return contains(s.right, v) elif s.root > v: return contains(s.left, v) 9 If 9 is in the set, it is in this branch Order of growth?

10

  • n average

Θ(h)

slide-76
SLIDE 76

Membership in Binary Search Trees

contains traverses the tree

  • If the element is not the root, it can only be in either the left or right branch
  • By focusing on one branch, we reduce the set by the size of the other branch

5 3 1 7 9 11 def contains(s, v): if s is BTree.empty: return False elif s.root == v: return True elif s.root < v: return contains(s.right, v) elif s.root > v: return contains(s.left, v) 9 If 9 is in the set, it is in this branch Order of growth?

10

  • n average

Θ(h) Θ(log n) on average for a balanced tree

slide-77
SLIDE 77

Adjoining to a Tree Set

11

slide-78
SLIDE 78

Adjoining to a Tree Set

5 3 1 7 9 11 8

11

slide-79
SLIDE 79

Adjoining to a Tree Set

5 3 1 7 9 11 8 Right!

11

slide-80
SLIDE 80

Adjoining to a Tree Set

5 3 1 7 9 11 8 Right!

11

slide-81
SLIDE 81

Adjoining to a Tree Set

5 3 1 7 9 11 8 7 9 11 8 Right!

11

slide-82
SLIDE 82

Adjoining to a Tree Set

5 3 1 7 9 11 8 7 9 11 8 Right! Left!

11

slide-83
SLIDE 83

Adjoining to a Tree Set

5 3 1 7 9 11 8 7 9 11 8 7 8 Right! Left!

11

slide-84
SLIDE 84

Adjoining to a Tree Set

5 3 1 7 9 11 8 7 9 11 8 7 8 Right! Left! E E

11

slide-85
SLIDE 85

Adjoining to a Tree Set

5 3 1 7 9 11 8 7 9 11 8 7 8 Right! Left! Right! E E

11

slide-86
SLIDE 86

Adjoining to a Tree Set

5 3 1 7 9 11 8 7 9 11 8 7 8 Right! Left! Right! E E 8 E

11

slide-87
SLIDE 87

Adjoining to a Tree Set

5 3 1 7 9 11 8 7 9 11 8 7 8 Right! Left! Right! E E 8 E Stop!

11

slide-88
SLIDE 88

Adjoining to a Tree Set

5 3 1 7 9 11 8 7 9 11 8 7 8 Right! Left! Right! E E 8 E Stop!

11

slide-89
SLIDE 89

Adjoining to a Tree Set

5 3 1 7 9 11 8 7 9 11 8 7 8 Right! Left! Right! E E 8 E Stop! 8

11

slide-90
SLIDE 90

Adjoining to a Tree Set

5 3 1 7 9 11 8 7 9 11 8 7 8 Right! Left! Right! E E 8 E Stop! 8 7 8

11

slide-91
SLIDE 91

Adjoining to a Tree Set

5 3 1 7 9 11 8 7 9 11 8 7 8 Right! Left! Right! E E 8 E Stop! 8 7 8 7 9 11 8

11

slide-92
SLIDE 92

Adjoining to a Tree Set

5 3 1 7 9 11 8 7 9 11 8 7 8 Right! Left! Right! E E 8 E Stop! 8 7 8 7 9 11 8 5 3 1 7 9 11 8

11

slide-93
SLIDE 93

Adjoining to a Tree Set

5 3 1 7 9 11 8 7 9 11 8 7 8 Right! Left! Right! E E 8 E Stop! 8 7 8 7 9 11 8 5 3 1 7 9 11 8 (Demo)

11