2. Chapter 2 abstract data types

1. Algorithms and Data Structures should be clever way to combine, to achieve the purpose to solve problems, and improve efficiency.

Static and dynamic organization operating algorithm 2. The data, constitute the ADT. Once the data structure of a certain selection, ADT's performance may be determined. It follows that the selection of essentially abstract data types is to determine the data structure.

3. Use an array to store data, the situation is not enough space beyond the waste or used up there will be (even dynamically allocated array will happen). vector is a good solution to this problem (which is a dynamically allocated arrays, but provides a good dynamic strategy).

4. If the data is stored in an ordered array, then the additions and deletions will be more trouble. (Vector in memory is stored consecutively). In response to dynamic changes in the data, it is necessary to break the physical form of stored contiguously, then emerged list (list container).

The binary search tree to find and link binding, add or delete elements that can be efficiently implemented. It should be noted, balance a binary search tree is an important indicator, once out of balance, look for a sharp decline in efficiency will be limited equilibrium level nodes to improve lookup performance.

6. In the different data structures while observing the implementation, the data structure should be found not only gives a stationary logical structure, we should find it gives migration rule from one state to another state.

7. Select from the different data structures, to determine what standard is used abstract data types by analyzing the total time to complete the task.

8. STL is a standard library written by the template, gives a variety of commonly used containers. The container may be said to be an abstract data type, can accommodate any type of object, and the internal data structure in accordance with certain objects organized.

9. Use of the vector Vector container substantially similar to an array, but a little that have flexible and have better performance.

10. The container list can list operating head and tail of the table needs to judge whether the list is empty when the delete operation. Action table and only the first end of the table abstract data type called a deque.

11. stack container stack can be performed pop (delete the top element), push (the new element on top of the stack), top (return to the top element).

12. The container queue queue can perform pop (delete the first team elements), push (the new elements in the tail), front (team returns the first element).

13. A priority queue may be performed container priority_que pop (remove the largest element), push (new element into the container), top (return tank largest element). Priority queue using header files also queue.

14. The collection vessel may perform set insert (insert element), erase (delete elements), find (find elements) and the like.

15. A collection container mutilset allowed to join multiple repetitive elements. Mutilset header files used is set.

16. The map is a collection container mapping objects stored key pair.

17. A multiple container mapping mutilmap.

18. iterators: not only can hide a container complex internal structure, but also improve access to inappropriate behavior and ease of use of constraints. (It should be noted, access to restricted container generally do not provide iterators)

19. Adapter: existing data type conversion, providing a new interface.

Guess you like

Origin www.cnblogs.com/Hello-Nolan/p/12229102.html