

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


The third quiz for the course will be on Wednesday, Mar 7, during your lab session. The following list provides more information about the quiz:
The following exercises cover the material to be included in this quiz. Solutions to these exercises will not be provided, but you are welcome to discuss your solutions with the TA or instructor during office hours. We strongly recommend you do not use Eclipse to write the code associated with these exercises. Try to answer the exercises in a piece of paper and then use Eclipse to verify your solutions. This approach will better prepare you for the quiz.
A. Huffman
A
D
1
1
0
0 1
0
0
C E
B
1
B. Heaps
Heap after inserting 9 Heap after inserting 40 in the previous heap Heap after inserting 2 in the previous heap Heap after inserting 7 in the previous heap Heap after inserting 10 in the previous heap Heap after inserting 30 in the previous heap Heap after deleting 2 from the previous heap
The MaxHeap class represents a max-heap. In a max-heap every element has a key value greater than or equal to either of its children. The class definition associated with the MaxHeap class is:
public class MaxHeap<E extends Comparable
Complete the implementation of the MaxHeap class, by providing the following methods:
a. insert( ) – Inserts an element in the heap. b. removeMax( ) – Removes the largest element from heap and returns that element. c. size( ) – Returns the size of the heap.
C. Binary Trees
public class BinarySearchTree <E extends Comparable