Lably
Skip to content

Double-ended priority queue

  • 6 min read
  • 4 chapters

Related on Lably

Through Computer science, Data structure and Big O notation

Operations

A double-ended priority queue features the following operations:

isEmpty()
Checks if DEPQ is empty and returns true if empty.
size()
Returns the total number of elements present in the DEPQ.
getMin()
Returns the element having least priority.
getMax()
Returns the element having highest priority.
put(x)
Inserts the element x in the DEPQ.
removeMin()
Removes an element with minimum priority and returns this element.
removeMax()
Removes an element with maximum priority and returns this element.

Also, the priority of any element can be changed once it has been inserted in the DEPQ.

Sign in to keep reading

3 more chapters are free with a Lably account.

More in Computing and communication