17. Implement the ADT list according to the specifications in List Interface using a resizable array that grows in the following fashion. When the array is full, create a new empty array of the same size that serves as an extension to the original one. When the first extension becomes full, create a second extension, and so on as needed. Figure 11-6 illustrates an array and its extensions.
Figure 11-6
An array and extensions for Project 17
This approach can be more efficient in both time and space than the resizable array-based list discussed in this chapter, since the entries are not copied, new arrays are smaller, and the memory for an extension that is no longer needed can be reclaimed. Managing the extensions provides several interesting challenges. For example, how do you track the extensions? Can you manage them in another type of ADT? Must you revise the methods add and remove, so that entries shift between extensions?
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here