Arrays and Linked Lists - Complexity Analysis - Advanced Concepts

Download Q&A
Q. In a doubly linked list, what is the time complexity for deleting a node given a pointer to that node?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. In a singly linked list, how do you find the middle element?
  • A. Traverse the list twice
  • B. Use two pointers
  • C. Count elements first
  • D. Use a stack
Q. What is the average time complexity for inserting an element at the end of a dynamic array?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. What is the space complexity of a recursive function that uses a stack?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. What is the time complexity of deleting the last element from a singly linked list?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. Which of the following operations has a time complexity of O(n) in a singly linked list?
  • A. Insertion at head
  • B. Insertion at tail
  • C. Deletion at head
  • D. Accessing an element by index
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