Container selection (container selection prompt)

Source: Internet
Author: User

1. IfProgramIf random element access is required, the vector or deque container should be used.

2. If the program must insert or delete elements in the middle of the container, the list container should be used.

3. If the program is not in the middle of the container, but inserts or deletes elements in the header or tail of the container, deque container should be used.

4. If you only need to insert an element in the middle of the container when reading the input and then randomly access the element, you can consider reading the element into a list container during the input, then the containers are re-sorted to make them suitable for sequential access, and then the sorted list containers are copied to a vector container.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.