Arrays and Linked Lists - Applications - Higher Difficulty Problems

Download Q&A
Q. In a binary tree, what is the maximum number of nodes at depth d?
  • A. d
  • B. 2^d
  • C. 2^(d+1) - 1
  • D. d^2
Q. In a graph represented by an adjacency list, what is the space complexity?
  • A. O(V)
  • B. O(E)
  • C. O(V + E)
  • D. O(V * E)
Q. In a queue implemented using two stacks, what is the time complexity of the dequeue operation in the worst case?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n log n)
Q. In a singly linked list, how can you find the middle element in one pass?
  • A. Use two pointers
  • B. Count nodes first
  • C. Use recursion
  • D. Use a stack
Q. What is the average time complexity of accessing an element in an array?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n log n)
Q. What is the space complexity of a recursive function that uses a linked list to store n elements?
  • A. O(1)
  • B. O(n)
  • C. O(n^2)
  • D. O(log n)
Q. What is the time complexity of finding the maximum element in an unsorted array?
  • A. O(n)
  • B. O(log n)
  • C. O(n log n)
  • D. O(1)
Q. What is the worst-case time complexity for inserting an element at the beginning of a singly linked list?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n log n)
Q. What is the worst-case time complexity of insertion sort?
  • A. O(n)
  • B. O(n log n)
  • C. O(n^2)
  • D. O(log n)
Q. Which algorithm is used to detect a cycle in a linked list?
  • A. Depth First Search
  • B. Breadth First Search
  • C. Floyd's Cycle Detection
  • D. Dijkstra's Algorithm
Q. Which data structure is best suited for implementing a priority queue?
  • A. Array
  • B. Linked List
  • C. Heap
  • D. Stack
Q. Which of the following operations can be performed in O(1) time on a stack?
  • 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