Question: What is the time complexity for locating an element with a given value in a doubly-linked list of N elements sorted in ascending order? (a)
What is the time complexity for locating an element with a given value in a doubly-linked list of N elements sorted in ascending order?
(a) O(1) (b) O(log N) (c) O(N) (d) O(N log N)
What is the time complexity for popping off the first (i.e., oldest) element pushed onto a stack which contains N elements?
(a) O(1) (b) O(log N) (c) O(N) (d) O(N log N)
One way to reverse the sequence of elements in a queue would be to dequeue them and push them onto a stack one by one, then pop all the elements off the stack while enqueueing them again. What would be the time complexity of performing this sequence of operations with a queue of N elements?
(a) O(1) (b) O(log N) (c) O(N) (d) O(N log N)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
