CS251 Homework 1

CS251 Midterm Review Homework

Please write the solutions and turn them in the day of the exam. The solutions will be posted the day before of the exam. However, we suggest you to see the solutions after you have written your own solutions.
 
1. Write a class DoubleLinkedList that stores pairs key, value. Write the methods. 
insertFront, insertEnd, removeFront, removeEnd.

DLList.cpp

DLList.h

2. Write a class HashTable that has methods insert, remove, and lookup. The type of the keys and data is char *. Also double the size of the hash table and do rehashing when the number of elements reaches the size of the table. HashTableVoid.cc

HashTableVoid.h

3. Write a class Heap that has methods insert and removeMin. Heap.cpp

Heap.h

4. Implement a function heapsort(int * array, int n) that sorts an array using the Heap data structure. HeapSort.cpp

HeapSort.h

5. Write a class BinarySearchDictionary that has methods insert, remove and lookup. BinSearchDictionary.cpp

BinSearchDictionary.h

6. Assume a heap. Draw the heap after each operation: insert(6)
insert(7);
insert(8);
insert(9);
insert(10);
insert(11);
insert(12);
insert(13);
insert(14);
insert(15);
insert(16);
insert(1);
insert(2);
insert(3);
insert(4)
removemin;
removemin;
removemin
removemin;
heap-sols0001.pdf