![]() |
In C++, deques are sequence containers in which a user can insert data at both the front and the end of the container. In this article, we will learn how to declare a deque in C++. Declaring a Deque in C++Deque is defined as the class template std::deque in the <deque> header file. So to create a deque in C++, we first have to include the <deque> header file. Then we can declare the deque by creating an instance of the template by passing the type of element as the template parameter and assign some identifier to this intance. Syntax to Declare a Dequedeque<dataType> dequeName; Here,
C++ Program to Declare a DequeThe following program illustrates how we can declare a deque in C++:
Output Deque Elements:1 2 3 4 5 Time Complexity: O(N), where N is the number of deque elements. |
Reffered: https://www.geeksforgeeks.org
C++ |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 13 |