Exercise 11.2-4

Suggest how to allocate and deallocate storage for elements within the hash table itself by linking all unused slots into a free list. Assume that one slot can store a flag and either one element plus a pointer or two pointers. All dictionary and free-list operations should run in \(O(1)\) expected time. Does the free list need to be doubly linked, or does a singly linked free list suffice?

Have each slot of the table \(T\) hold a flag of \(1\) if there is a value in that element and \(0\) if it is free. To maintain the required runtime, our free list must be doubly linked.