Question: a ) One can implement a stack based on a linked list so that all relevant push / pop operation is time O ( 1

a) One can implement a stack based on a linked list so that all relevant push/pop operation is time O(1).
b) One can not implement a stack (of unbounded size) based on an array so that each individual push/pop operation is time O(1).
c) The core data structure of Depth-First Search is a stack.
d) One can reverse the order of the elements in a singly linked list in time O(N).
e) It is possible to append two priority queues in time O(1).
f) Adding an element to a Stack has worst-case time complexity O(log(N)).
g) Returning the maximum element in a PriorityQueue (larger the element, higher the priority) can be done in time O(1).
g) Returning the minimum element in a PriorityQueue (larger the element, higher the priority) can be done in time O(1).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!