QUESTION 11
(a)
Explain how binary search trees can become unbalanced and hence not deliver optimal insertion and retrieval performance. How do AVL trees overcome this unbalancing?
(4 marks) Using diagrams, create an AVL tree by inserting the following numbers in sequence: 12, 4, 8, 17, 12, 20, 15. For full marks, you must show the construction of the tree at each stage.
(b)
(6 marks) Total (10 marks)
QUESTION 12
(a)
Given is a graph G. Draw a picture of an adjacency list data structure that represents this graph
(3 marks)
(b)
List the order of nodes visited using a breadth-first traversal of the graph
(2 marks)
(c)
How do B-Trees differ from binary search trees?
(3 marks)
(d)
How do B-trees optimize the cost of insertion?
(2 marks)
Total (10 marks)