educative.io

Educative

The deque stores elements in decreasing order

Are you sure about this:
“The deque stores elements in decreasing order.”


Type your question above this line.

Course: https://www.educative.io/collection/5642554087309312/5679846214598656
Lesson: https://www.educative.io/collection/page/5642554087309312/5679846214598656/210002

Hi @semih_kekul, we are glad you reached us.

Yes the statement is true, as the deque stores indexes of array elements in decreasing order and the front of the dequeue stores the element that is largest till the traversed elements in the array. Whenever an array element is traversed that is larger than the index element stored at back of the deque, it pops, and eventually, the front of deque maintains the max array element.

I hope Educative has helped you in your learning :slight_smile: