Complexity of Interval Heap Operations

Data Structure AlgorithmsAnalysis of AlgorithmsAlgorithms

A double-ended priority queue(DEPQ) or interval heap features the following operations −

isEmpty()

This function performs to check if DEPQ is empty and returns true if empty.

size()

This function performs to return the total number of elements present in the DEPQ.

getMin()

This function performs to return the element having lowest priority.

getMax()

This function performs to return the element having maximum priority.

put(z)

This function performs to insert the element z in the DEPQ.

removeMin()

This function performs to remove an element with smallest priority and returns this element.

removeMax()

This function performs to remove an element with highest priority and returns this element.

  • The operations isEmpty(), size(), getMin(), and getMax() consume O(1) time each;
  • put(z), removeMin(), and removeMax() consume O(log n) each;
  • Initializing an n element interval heap takes O(n) time.
raja
Published on 03-Jan-2020 05:27:12
Advertisements