Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deque details add #219

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,40 @@ int main() {
}

```

## Deque

Double-ended queues are sequence containers with the feature of expansion and contraction on both ends. They are similar to vectors, but are more efficient in case of insertion and deletion of elements.

deque::push_front() It is used to push elements into a deque from the front.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this as markdown table

deque::push_back() This function is used to push elements into a deque from the back.
deque::pop_front() This function is used to pop or remove elements from a deque from the front.
deque::pop_back() This function is used to pop or remove elements from a deque from the back.
deque::front() This function is used to reference the first element of the deque container.
deque::back() This function is used to reference the last element of the deque container.
deque::clear() This function is used to remove all the elements of the deque container, thus making its size 0.
deque::erase() This function is used to remove elements from a container from the specified position or range.

```c

#include <iostream>
#include <deque>
using namespace std;
int main() {
deque<int> q;

q.push_back(10);
q.push_front(20);
q.push_back(30);
q.push_front(15);

q.pop_front();
q.pop_back();
}

```


## Sort one-line

Sorting is one of the most basic functions applied to data. It means arranging the data in a particular fashion, which can be increasing or decreasing. There is a builtin function in C++ STL by the name of sort().
Expand Down Expand Up @@ -424,4 +458,4 @@ sort(v.begin(), v.end(), greater<int>()); // sorting in the vector in descending
|#include<time.h> | It is used to perform functions related to date() and time|
|#include<graphics.h> | It is used include and facilitate graphical operations in program|
|#include<bits/stdc++.h> | It is used to include all the standard library files|
|#include <bits/stdc++.h> | Inlcude all the headers. A Usefull Hack for Competitive Programming|
|#include <bits/stdc++.h> | Inlcude all the headers. A Usefull Hack for Competitive Programming|