asg11 - COP3530 Assignment11 Due:13thNov2009 Q1.AVLtree...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
COP 3530 Assignment 11 Due: 13 th Nov 2009 Q1 . AVL tree Start with an empty AVL search tree and insert the following keys in the given order: 25, 35, 45, 20, 22, 27. Draw the trees following each insertion, and also after each rotation. Specify the rotation types. You do need to specify the balancing factors. Q2. Binary Search Tree In this problem, you will extend the BinarySearchTree class to support several additional functions. PLEASE put all your solutions in one single java file. Name this file MyBinarySearchTree.java. a) Implement a new method check() , which will check whether the current tree is a binary search tree or not. For example, if MyBinarySearchTree t equals to: then t.check() should return true. But if t equals to: t.check() should return false.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
b) Implement a new method removeLarger(int x) , which will remove all elements larger than x from a given binarySearchTree. For example, if t equals to: After calling t.removeLarger(5) , t should become Note that the worst time complexity of your method must be O(n), where n is
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 4

asg11 - COP3530 Assignment11 Due:13thNov2009 Q1.AVLtree...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online