Академический Документы
Профессиональный Документы
Культура Документы
briefly explain enough about OOP to get you started. Finally, for C++ programmers who
don't know Java, we'll point out some of the differences between these languages.
Array Quick insertion, very fast Slow search, slow deletion, fixed
access if index known size.
Ordered array Quicker search than Slow insertion and deletion, fixed
unsorted array. size.
Hash table Very fast access if key Slow deletion, access slow if key
known. Fast insertion. not known, inefficient memory
usage.
- 12 -
Comparing the General-Purpose Storage Structures
Table 15.1 summarizes the speeds of the various general-purpose data storage
structures using Big O notation.
Insertion in an unordered array is assumed to be at the end of the array. The ordered array
uses a binary search, which is fast, but insertion and deletion require moving half the items
on the average, which is slow. Traversal implies visiting the data items in order of
ascending or descending keys; the — means this operation is not supported.
Stacks, queues, and priority queues are abstract data types (ADTs) that are implemented
by a more fundamental structure such as an array, linked list, or (in the case of the
priority queue) a heap. These ADTs present a simple interface to the user, typically
allowing only insertion and the ability to access or delete only one data item. These items
are
- 514 -