Question: A splay tree is a binary search tree with amortised complexity O(log(n)) per operation. (i) What is meant by amortised complexity? [1 mark] (ii) Draw

A splay tree is a binary search tree with amortised complexity O(log(n)) per operation.

(i) What is meant by amortised complexity? [1 mark]

(ii) Draw the three different splay rotations that may be applied when the target node is the left child of its parent. Take care to include the location of subtrees before and after each rotation. [9 marks]

(iii) Why is a red–black tree a better general-purpose search structure than a splay tree? Under what circumstances would you choose to implement a splay tree in preference to a red–black tree, and why? [4 marks]

(b) Heapsort is an O(n log(n)) sorting algorithm based on the heap data structure. (i) What is the heap property? [1 mark]

(ii) Briefly describe how heapsort is related to the classic quadratic-time selection sort algorithm, explaining how heapsort manages to sort more efficiently. [5 marks]

Step by Step Solution

3.34 Rating (169 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The detailed answer for the above question is provided below i Amortised complexity refers to the average performance of an operation over a long sequ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!