Computer Knowledge

Data Structures and Algorithms

1,518 Questions

Data Structures and Algorithms form the core of computer science, focusing on arrays, linked lists, trees, and sorting mechanisms. These concepts are essential for solving complex computational problems efficiently. Test takers preparing for technical and administrative IT exams will find these questions highly relevant.

Array OperationsLinked List ApplicationsSorting AlgorithmsTree Data StructuresMultilevel IndexingAlgorithm Time Complexity

Data Structures and Algorithms Questions

Multiple choice
  1. Takes O (3n) and $\Omega$(2n) time if hashing is permitted
  2. Takes O (n3) and $\Omega$ (n2.5) time in the key comparison model
  3. Takes $\odot$ (n3) time and space
  4. Takes O ($\sqrt{n}$) time only if the sum of the 2n elements is an even number
Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Multiple choice
  1. only (i)

  2. only (ii)

  3. either (i) or (ii) but not both

  4. neither (i) nor (ii)

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Multiple choice
  1. 1, 3, 5, 6, 8, 9

  2. 9, 6, 3, 1, 8, 5

  3. 9, 3, 6, 8, 5, 1

  4. 9, 5, 6, 8, 3, 1

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

the all its children

Multiple choice
  1. 10, 7, 9, 8, 3, 1, 5, 2, 6, 4

  2. 10, 9, 8, 7, 6, 5, 4, 3, 2, 1

  3. 10, 9, 4, 5, 7, 6, 8, 2, 1, 3

  4. 10, 8, 6, 9, 7, 2, 3, 4, 1, 5

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Multiple choice
  1. n + m $\le$ x < 2n and 2m $\le$ y $\le$ n + m
  2. n + m $\le$ x < 2n and 2m $\le$ y $\le$ 2n
  3. 2m $\le$ x < 2n and 2m $\le$ y $\le$ n + m
  4. 2m $\le$ x < 2n and 2m $\le$ y $\le$ 2n
Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The order in which insert and delete operations are performed matters here. The best case: Insert and delete operations are performed alternatively. In every delete operation, 2 pop and 1 push operations are performed. So, total m+ n push (n push for insert() and m push for delete()) operations and 2m pop operations are performed. The worst case: First n elements are inserted and then m elements are deleted. In first delete operation, n + 1 pop operations and n push operation are performed. Other than first, in all delete operations, 1 pop operation is performed. So, total m + n pop operations and 2n push operations are performed (n push for insert() and n push for delete())

Multiple choice
  1. 8, −, −, −, −, −, 10

  2. 1, 8, 10, −, −, −, 3

  3. 1, −, −, −, −, −, 3

  4. 1, 10, 8, −, −, −, 3

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation