In the implementation of HashMap in this chapter, the put() and get() methods used a utility method, find(), to locate an entry with a given key. The remove() method also needs to find an entry with a given key, but we cannot use find() because remove() needs a reference to the target’s predecessor in a chain so that the chain can be reconnected once the target entry has been removed. If the chains were implemented as a doubly linked list, put(), get(), and remove() could all use find(). Would it be worth it to change the implementation along these lines?

What will be an ideal response?


The solution comes at the cost of the extra link in each entry in a bucket chain as well as the added complexity of dealing with the second link. The advantage of the change is that internally the task of finding a node is consolidated within a single method.

Computer Science & Information Technology

You might also like to view...

The ________ service startup types increases the amount of time required for a Windows 10 computer to boot up

Fill in the blank(s) with correct word

Computer Science & Information Technology

The ____________________ organizes all of the functions by category and allows you to search for functions that perform particular calculations.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

The process of recording data onto a recordable or rewritable optical disc is called tracking. _________________________

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

When a Dreamweaver page is created, an option called ____ is placed in the first line of HTML code.

A. DocType B. CodeType C. AppType D. HTMLVersion

Computer Science & Information Technology