Arrays and Linked Lists - Complexity Analysis - Higher Difficulty Problems

Download Q&A
Q. In a binary search tree, what is the time complexity for inserting an element in the average case?
  • A. O(1)
  • B. O(log n)
  • C. O(n)
  • D. O(n log n)
Q. In a binary search tree, what is the time complexity of searching for an element in the average case?
  • A. O(1)
  • B. O(log n)
  • C. O(n)
  • D. O(n log n)
Q. In a complete binary tree, what is the maximum number of nodes at level 'h'?
  • A. 2^h
  • B. 2^(h+1) - 1
  • C. h^2
  • D. h!
Q. What is the space complexity of a recursive function that uses a stack for function calls?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. What is the time complexity of a linear search in an array?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n log n)
Q. What is the time complexity of a linear search in an unsorted array?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n log n)
Q. What is the time complexity of deleting an element from a doubly linked list?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. What is the time complexity of deleting an element from a singly linked list when the pointer to the node is given?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. What is the time complexity of the quicksort algorithm in the worst case?
  • A. O(n)
  • B. O(n log n)
  • C. O(n^2)
  • D. O(log n)
Q. What is the worst-case time complexity for searching an element in a linked list?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. Which data structure is used to implement a queue?
  • A. Array
  • B. Linked List
  • C. Both Array and Linked List
  • D. None of the above
Q. Which of the following operations on a stack has a time complexity of O(1)?
  • A. Push
  • B. Pop
  • C. Peek
  • D. All of the above
Showing 1 to 12 of 12 (1 Pages)
Soulshift Feedback ×

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

Not likely Very likely