Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Algorithms

Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest

3rd edition

978-0262033848

More Books

Students also viewed these Algorithms questions