CIS1000C Chapter 8 Trees and Graphs
CIS1000C
Chapter 8
Linear ADTs Lab
Note: To get credit, you must score 60 pts. or higher
|
Name: |
|
1. Draw the binary search tree whose elements are inserted in the following order: (25 pts.)
50 72 96 94 107 26 12 11 9 2 10 25 51 16 17 95
2. If Print is applied to the tree formed in Exercise 1, in which order would the elements be printed? (10 pts.)
3. Trace the Binary Search algorithm to find an item whose value is 15 (25 pts.)
|
Tree |
IsThere(tree, item) call |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Return Value:
4. Trace the Binary Search algorithm to find an item whose value is 26 (25 pts.)
|
Tree |
IsThere(tree, item) call |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Return Value:
5. Given the following graph: (5 pts. Each)
|
a. |
Is there a path from Oregon to any other state in the graph? |
|
|
b. |
Is there a path from Hawaii to every other state in the graph? |
|
|
c. |
From which state(s) in the graph is there a path to Hawaii? |
|