[SOLVED] Assignment 2

30.00 $

Categories: , Tags: , , ,
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Assignment2Solution.zip (4.8 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (3 votes)
  1. (15 marks) Design an algorithm for the following operations for a binary tree BT, and show the worst-case running times for each implementation: preorderNext(x): return the node visited after node x in a pre-order traversal of BT. Postor
  2. (25 marks) Design a recursive linear-time algorithm that tests whether a binary tree satisfies the search tree order property at every node.
  3. (20 marks) Exercise 8.2. Illustrate what happens when the sequence 1, 5, 2, 4, 3 is added to an empty ScapegoatTree, and show where the credits described in the proof of Lemma 8.3 go, and how they are used during this sequence of additions.
  4. (20 marks) Implement a commonly used hash table in a program that handles collision using linear probing. Using (K mod 13) as the hash function, store the following elements in the table: {1, 5, 21, 26, 39, 14, 15, 16, 17, 18, 19, 20, 111, 145, 146}.
  5. (20 marks) Exercise 6.7. Create a subclass of BinaryTree whose nodes have fields for storingpreorder, post-order, and in-order numbers. Write methods preOrderNumber(), inOrderNumber(), and postOrderNumbers() that assign these numbers correctly. These methods should each run in O(n) time.
  • Assignment2Solution.zip