Containers, Algorithms, Iterators in STL

1 container: a place to store things.
STL container: realize some of the most widely used data structures, commonly used data structures: array, linked list, tree, stack, queue, collection, mapping table, etc.
Classification:
① Serial container: Emphasizes the sorting of values, and each element in the serial container has a fixed position.
② Associative container: Binary tree structure, there is no strict physical order relationship between elements.

2 Algorithm: The solution to the problem.
Algorithms: Solve logical or mathematical problems in a limited number of steps.
Classification:
① Qualitative change algorithm: refers to the content of the elements in the interval that will be changed during the operation. Such as copying, replacing, deleting, etc.
② Non-qualitative algorithm: It means that the content of elements in the interval will not be changed during the operation, such as searching, counting, traversing, finding extreme values, etc.

3 Iterators: the glue between containers and algorithms.
Provides a method that enables sequential access to the elements contained in a container without exposing the container's internal representation.
Each container has its own dedicated iterator. The use of iterators is very similar to pointers. At the beginning stage, we can first understand that iterators are pointers.

Guess you like

Origin blog.csdn.net/weixin_46252427/article/details/128704728