# Include <deque>

Source: Internet
Author: User
Deque

The \ (deque \) header file mainly includes a dual-end queue container. It is a linear storage space that can be inserted at both ends to delete, similar to vector and queue. Compared with \ (vector \), \ (deque \) can insert elements at the beginning of \ (O (1. Compared with \ (queue \), \ (deque \) can be randomly accessed as an array.

Declaration Method
Deque <int> q; deque <int>: iterator it;
Q. Size ()

Returns the size of the double-ended queue.

Q. Empty ()

Whether the double-end queue is empty.

Q. Clear ()

Clear the container.

[]

Random Access like \ (vector.

Q. Begin ()/Q. End ()

Returns the first iterator or the last iterator.

Q. Front ()/Q. Back ()

Returns the header/tail element.

Q. push_front (X)/Q. push_back ()

Insert element \ (x \) at the head/end of the team \).

Q. pop_front ()/Q. pop_back ()

Show team Header/team end Elements

# Include <deque>

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.