Stacks and Queues - Complexity Analysis - Problem Set

Download Q&A
Q. If a stack is implemented using a linked list, what is the time complexity of the 'pop' operation?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. In a stack, what is the time complexity of the 'top' operation?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. What is the time complexity of clearing all elements from a stack?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. What is the time complexity of dequeuing an element from a queue implemented using a circular array?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. What is the worst-case time complexity for searching an element in a queue?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. Which data structure allows for both LIFO and FIFO operations?
  • A. Stack
  • B. Queue
  • C. Deque
  • D. Array
Q. Which of the following operations has a time complexity of O(n) in a stack?
  • A. Push
  • B. Pop
  • C. Peek
  • D. None of the above
Showing 1 to 7 of 7 (1 Pages)
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely