Access Millions of academic & study documents

A deque with heap order is a data structure consisting of a list of

Content type
User Generated
Showing Page:
1/1
A deque with heap order is a data structure consisting of a
list of items, on which the following operations are
possible:
push(x): Insert item x on the front end of the deque.
pop(): Remove the front item from the deque and return it.
inject(x): Insert item x on the rear end of the deque.
eject(): Remove the rear item from the deque and return it.
findMin(): Return the smallest item from the deque
(breaking ties arbitrarily).
1.a. Describe how to support these operations in constant
amortized time per operation.
2.**b. Describe how to support these operations in
constant worst-case time per operation.
Solution
for queue worst case is O(n)
for push and pop the amortized time is O(1).
worst case is O(nlogn).

Sign up to view the full document!

lock_open Sign Up
Unformatted Attachment Preview
A deque with heap order is a data structure consisting of a list of items, on which the following operations are possible: push(x): Insert item x on the front end of the deque. pop(): Remove the front item from the deque and return it. inject(x): Insert item x on the rear end of the deque. eject(): ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Studypool
4.7
Indeed
4.5
Sitejabber
4.4

Similar Documents