3. Suppose you didnt want to maintain a set of sorted data elements as a tree, but...
Question:
3. Suppose you didn’t want to maintain a set of sorted data elements as a tree, but chose a linked list implementation instead, despite its obvious inefficiencies. The list is ordered by key values in ascending order; that is, the lowest key value is at the head of the list. To locate a data element, you search the list linearly until you find a key value that is greater than the key value of the item’s key. If the purpose of this search is to insert another item in the list, how would you achieve this insertion? In other words, give a pseudocode algorithm that lists each step. You can make this algorithm somewhat more efficient by slightly changing the data structure of the list.
Step by Step Answer:
Analysis And Design Of Energy Systems
ISBN: 9780135259733
3rd Edition
Authors: B. Hodge, Robert Taylor