We've seen in class how the two Priority Queue operations "insert" and “deleteHighest" can be implemented with a heap, in O(n log n) .

computer science

Description

In this assignment, we will compare the BSTs and Heaps operations in two respects: 

a) INSERT and DELETEHIGHEST 

b) Sorting 


A) We've seen in class how the two Priority Queue operations "insert" and “deleteHighest" can be implemented with a heap, in O(n log n) . In this assignment, you are asked to implement the same two operations also on a BST (we’ve also seen in class how to insert in a BST). You should then compare the behaviour of the two ADTs for these two operations. Here are the steps:


1. Implement the class Heap and the class BST, each containing an Insert() and DeleteHighest() operations. 

2. Generate a random sequence (of size n) of numbers. Store the sequence in a List (you will also need to implement a List class). 

3. Insert the n numbers generated in the Heap structure. 

4. Insert the same random numbers in a BST. 

5. Iteratively apply deleteHighest on both the Heap and the Tree, storing the deleted elements in two different Lists. 

6. Compares the two Lists to make sure the sequence of DeleteHighest was the same. 




Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.