Stacks and Queues - Complexity Analysis - Advanced Concepts

Download Q&A
Q. In a queue, what is the time complexity of dequeuing an element?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. In a stack, what is the time complexity of accessing the top element?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. What is the space complexity of a queue implemented using two stacks?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. What is the time complexity of checking if a stack is empty?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. What is the time complexity of reversing a stack using recursion?
  • A. O(n)
  • B. O(n log n)
  • C. O(n^2)
  • D. O(1)
Q. What is the worst-case time complexity of sorting a stack using another stack?
  • A. O(n)
  • B. O(n log n)
  • C. O(n^2)
  • D. O(n^3)
Showing 1 to 6 of 6 (1 Pages)
Soulshift Feedback ×

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

Not likely Very likely