Computer Knowledge

Data Structures and Algorithms

1,256 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. $\bar L_1$ is recursive and $\bar L_2$ is recursively enumerable
  2. $\bar L_1$ is recursive and $\bar L_2$ is not recursively enumerable
  3. $\bar L_1$ and L2 are recursively enumerable
  4. $\bar L_1$ is recursively enumerable and $\bar L_2$ is recursive
Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The rules here used will be. All those languages which are recursive their complements are also recursive. So option (1) & (2) can be correct. Now languages which are recursively enumerable but not recursive, their complements can't be recursively enumerable. So only option (2) is correct

Multiple choice
  1. O(n log n)

  2. O(n)

  3. O(log n)

  4. O(1)

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

Here we can follow simple procedure, we can rum heap sort for 7 iterations. In each iteration the top most element is smallest, we note & then replace it with the last element, then we run min heapify algorithm, which brings next smallest element on top. This procedure take 0 (log n) time. We need to run it for 7 times. So tight bound O(7 log n) = O(log n)

Multiple choice
  1. remain O (n2)

  2. become O (n (log n)2)

  3. become O (n log n)

  4. become O (n)

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

Binary search is efficient when the sorted sequence is there, but the worst case scenario for insertion sort would not be sorted sequence so even using binary search instead of linear search the complexity of comparisons will remain O (n2)

Multiple choice
  1. Takes $\Theta$(3n) and $\Omega$(2n) time if hashing is permitted
  2. Takes $\Theta$(n3) and $\Omega$ (n2.5) time in the key comparison model
  3. Takes $\Theta$(n3) time and space
  4. Takes $\Theta$($\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. 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