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
-
Traversing
-
Searching
-
Merging
-
Sorting
-
Inserting
D
Correct answer
Explanation
Arranging the records in some logical order is referred to as sorting.
-
Tree
-
Graph
-
Linked list
-
All of the above
-
None of the above
C
Correct answer
Explanation
It is a linear data structure. A linear data structures elements are arranged in a list.
-
Generic Flow Control
-
Cell Loss Priority
-
Header Error Control
-
Virtual Path Identifier
-
Payload Type Indicator
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.
-
O(n2)
-
O(n log n)
-
O(n)
-
O(log n)
A
Correct answer
Explanation
Using Master Theorem: a=3, b=4, f(n)=n^2. Since n^(log_4(3)) ≈ n^0.79 < n^2, we're in Case 3 where f(n) dominates. Therefore T(n) = O(n^2). The recursive calls at each level contribute polynomial work, but the n^2 term at the root determines overall complexity.
-
O(n2)
-
O(n log n)
-
O(n)
-
O(log n)
-
O(n2)
-
O(n log n)
-
O(n)
-
O(log n)
-
O(n2)
-
O(n log n)
-
O(n)
-
O(log n)
-
O(n2)
-
O(n log n)
-
O(n)
-
O(log n)
B
Correct answer
Explanation
Using Master Theorem: a=3, b=4, f(n)=n log n. Since n^(log_4(3)) ≈ n^0.79 < n log n, we're in Case 3 where f(n) dominates by a polynomial factor. Therefore T(n) = O(n log n), which matches the claimed answer B.
-
O(n2)
-
O(n log n)
-
O(n)
-
O(log n)
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.
-
O(n2√n)
-
O(n log n)
-
O(n)
-
O(log n)
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.
-
O(n2)
-
O(n log n)
-
O(n)
-
O(nloglog n)
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.
-
O(n2)
-
O(n log n)
-
O(n)
-
O(log n)
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.
-
O(n2)
-
O(nlog 3)
-
O(n)
-
O(log n)
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)).
-
O(n2)
-
O(n log n)
-
O(n)
-
O(log n)
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.
-
O(n2)
-
O(nlog3)
-
O(n)
-
O(log n)