As presented in the text, linked lists must be searched sequentially. For large lists, this can result

Question:

As presented in the text, linked lists must be searched sequentially. For large lists, this can result in poor performance. A common technique for improving list-searching performance is to create and maintain an index to the list. An index is a set of references to key places in the list. For example, an application that searches a large list of names could improve performance by creating an index with 26 entries—one for each letter of the alphabet. A search operation for a last name beginning with ‘Y’ would then first search the index to determine where the ‘Y’ entries began, then “jump into” the list at that point and search linearly until the desired name was found.

This would be much faster than searching the linked list from the beginning. Use the List class of Fig. 21.3 as the basis of an IndexedList class. Write a program that demonstrates the operation of indexed lists. Be sure to include methods insertInIndexedList, searchIndexedList and delete-FromIndexedList.

Fig. 21.3I // Fig. 21.3: List.java 2 // ListNode and List class declarations. package com.deitel.datastructures; 3 4 5

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  answer-question

Java How To Program Late Objects Version

ISBN: 9780136123712

8th Edition

Authors: Paul Deitel, Deitel & Associates

Question Posted: