|
7.3.1 An Unordered ListAn unordered list would enter each name sequentially as it is declared. The lookup operation must then search linearly, and, thus, in the worst case, would have to look at all n entires and in the average case at half of them. Thus the search time is of order n, O(n). There is really no good reason to have such an inefficient data structure unless it is known that the number of entries will be exceedingly small, perhaps less than a couple dozen names. Example 2 shows an unordered list structure for the program of Example 1 Example 2 An unordered list structure
Send questions and comments to: Karen Lemone
|