2079 1

CSC211 · 2079 · 10 marks

Why do we need to balance the binary search tree? Justify with an example. Create an AVL tree from the data 24, 12, 8, 15, 35, 30, 57, 40, 45, 78.

Why do we need to balance the binary search tree? Justify with an example. Create an AVL tree from the data 24, 12, 8, 15, 35, 30, 57, 40, 45, 78.[10]

Data Structures and AlgorithmsChapter 8: Trees and GraphsAVL tree and Balancing algorithm, Applications of TreesNumerical: AVL tree construction

A binary search tree gives $O(\log n)$ search, insertion and deletion only while its height stays close to $\log2 n$. The shape of the tree, however, depends entirely on the order in which the keys arrive, and nothing in the plain insertion rule prevents it from growing tall and thin. In the wors...