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. Generic Flow Control

  2. Cell Loss Priority

  3. Header Error Control

  4. Virtual Path Identifier

  5. Payload Type Indicator

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

This field in ATM cell header is carried in the final octet of the header and provides an eight-bit cyclic redundancy check remainder that covers the entire header.

Multiple choice
  1. O(n2)

  2. O(n log n)

  3. O(n)

  4. O(log n)

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

Using Master Theorem: a=9, b=3, f(n)=n. Critical exponent: log_3(9)=2, so n^(log_b(a))=n^2. Since f(n)=n < n^2, we're in Case 1 where the recursive part dominates. Therefore T(n) = O(n^2). This matches the claimed answer A - this recurrence represents 9 recursive calls each on 1/3 of the input.

Multiple choice
  1. O(n2√n)

  2. O(n log n)

  3. O(n)

  4. O(log n)

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

Using the Master Theorem: a=4, b=2, so n^(log_b a) = n^2. The function f(n) = n²√n = n^2.5 is polynomially larger than n^2 (by factor n^0.5). Since the regularity condition a·f(n/b) ≤ c·f(n) holds, case 3 applies: T(n) = Θ(f(n)) = Θ(n²√n). The n log n option would only apply if f(n) = O(n^2), which is false here.

Multiple choice
  1. O(n2)

  2. O(n log n)

  3. O(n)

  4. O(nloglog n)

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

The recursion tree has log n levels, each contributing n/log(n/2^i). Level 0: n/log n, Level 1: n/log(n/2), ..., Level log n: O(log n). Using the integral approximation, the sum of n/log(n/2^i) for i=0 to log n is O(n log log n). This is because we're essentially summing 1/log(x) which gives the log log factor.

Multiple choice
  1. O(n2)

  2. O(n log n)

  3. O(n)

  4. O(log n)

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

At each level, the total work is n + n/2 + n/4 + n/8 + ... (sum of T(n/2), T(n/4), T(n/8) contributions) plus the constant n at the root. The sum n(1 + 1/2 + 1/4 + 1/8 + ...) converges to 2n = O(n). The O(n²) option would require quadratic growth at each level, and O(log n) ignores the linear work at each node.

Multiple choice
  1. O(n2)

  2. O(nlog 3)

  3. O(n)

  4. O(log n)

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

Using the Master Theorem for recurrence relations of the form T(n) = aT(n/b) + f(n), here a = 3, b = 2, and f(n) = n log n. Comparing f(n) = n log n with n^(log_b a) = n^(log_2 3), since log_2 3 is approximately 1.585, n^1.585 grows faster than n log n. Thus, Case 1 applies, yielding O(n^(log 3)).

Multiple choice
  1. O(n2)

  2. O(n log n)

  3. O(n)

  4. O(log n)

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

This recurrence adds log n at each of n steps. Summing log 1 + log 2 + ... + log n = log(n!) ≈ n log n - n + O(log n) by Stirling's approximation. Therefore T(n) = O(n log n). The O(n) option would require constant work per step, and O(n²) would require linearly growing work.