WGU C949 Objective Assessment
Data Structures and Algorithms I | Version 2 | Latest 2026/2027
Questions and Verified Answers | 100% Correct | Grade A
Section 1: Algorithm Analysis and Complexity
Q1: What is the time complexity of the following code snippet?
for i in range(n):
for j in range(i, n):
print(i, j)
A. O(n)
B. O(n log n)
C. O(n2) [CORRECT]
D. O(n3)
Correct Answer: C
Rationale: The outer loop runs n times and inner loop runs (n-i) times. Summing n+(n-1)+...+1 = n(n+1)/2 = O(n2). O(n log n) is typical of
merge sort, O(n3) represents triple-nested full-range loops.
Q2: Which asymptotic notation provides the tightest bound for f(n) = 3n2 + 5n + 7?
A. O(n3)
B. O(n2)
C. Theta(n2) [CORRECT]
D. Omega(n3)
Correct Answer: C
Rationale: Big-Theta provides both upper and lower bounds. Since f(n) is bounded above and below by constant multiples of n2 for large n,
f(n) = Theta(n2). Big-O(n2) gives only an upper bound.
Q3: Using the Master Theorem, solve T(n) = 4T(n/2) + n2 log n.
A. O(n2 log n) [CORRECT]
B. O(n2)
C. O(n3)
D. O(n log n)
Correct Answer: A
Rationale: With a=4, b=2: nlog_2(4) = n2. Since f(n) = n2 log n fits extended Case 2 with k=1, the solution is Theta(n2 log2 n).
Q4: In amortized analysis, a dynamic array that doubles when full has amortized insertion cost of:
A. O(n)
B. O(log n)
C. O(n2)
D. O(1) [CORRECT]
Correct Answer: D
Rationale: Occasional O(n) resize after n/2 insertions spreads the cost. Total cost for n insertions is O(n), giving O(1) amortized per
insertion. This is a classic aggregate/potential method example.
100% Correct | Grade A | Verified Answers Page 1
,WGU C949 Data Structures and Algorithms I | Objective Assessment | Version 2
Q5: What does f(n) = o(g(n)) (little-o) indicate?
A. f grows at the same rate as g
B. f is bounded above by g but not tightly
C. f grows strictly slower than g [CORRECT]
D. f is bounded below by g
Correct Answer: C
Rationale: Little-o means f(n)/g(n) approaches 0 as n approaches infinity, so f grows strictly slower than g. This is stricter than Big-O which
allows the ratio to approach a constant.
Q6: Algorithm A: worst-case O(n log n). Algorithm B: average O(n), worst O(n2). For a real-time system, which is better?
A. Algorithm B, average-case is better
B. Algorithm A, worst-case guarantees are essential [CORRECT]
C. Algorithm B, O(n) is always faster
D. Algorithm A, O(n log n) always beats O(n2)
Correct Answer: B
Rationale: Real-time systems require predictable bounded execution. Algorithm A guarantees O(n log n) always, while B could degrade to
O(n2) and miss deadlines. Average-case provides no real-time guarantees.
Q7: What is the space complexity of merge sort on n elements?
A. O(1)
B. O(log n)
C. O(n) [CORRECT]
D. O(n log n)
Correct Answer: C
Rationale: Merge sort requires O(n) auxiliary space for temporary merge arrays. While recursion depth is O(log n), each level needs O(n)
total space. This contrasts with quicksort O(log n) stack and heapsort O(1) auxiliary.
Q8: Which is NOT a valid property of Big-O notation?
A. If f=O(g), then kf=O(g) for k>0
B. If f=O(g) and g=O(h), then f=O(h)
C. If f=O(g), then g=O(f) [CORRECT]
D. O(f+g) = max(O(f), O(g))
Correct Answer: C
Rationale: Big-O is not symmetric: f=O(g) does not imply g=O(f). For example, n=O(n2) but n2 is not O(n). The other three are valid
transitivity, scaling, and max properties.
Q9: Given T(n) = 2T(n/2) + O(n), which sorting algorithm does this represent?
A. Bubble Sort
B. Insertion Sort
C. Merge Sort [CORRECT]
D. Selection Sort
Correct Answer: C
Rationale: Merge sort divides into two halves (2T(n/2)) and merges in O(n). By Master Theorem with a=2, b=2: nlog_2(2)=n, Case 2 yields
O(n log n). Bubble, insertion, and selection sort all have O(n2) worst-case.
100% Correct | Grade A | Verified Answers Page 2
, WGU C949 Data Structures and Algorithms I | Objective Assessment | Version 2
Q10: What is quicksort's best-case when the pivot consistently picks the median?
A. O(n)
B. O(n log n) [CORRECT]
C. O(n2)
D. O(log n)
Correct Answer: B
Rationale: Median pivot splits the array into equal halves, creating a balanced tree of depth log n with O(n) work per level: O(n log n). O(n)
is impossible for comparison-based sorting due to the Omega(n log n) lower bound.
Q11: What does the potential method in amortized analysis use?
A. A counter tracking operations
B. A potential function capturing actual vs. amortized cost difference [CORRECT]
C. A probability distribution over inputs
D. A recurrence relation based on input size
Correct Answer: B
Rationale: The potential method assigns a potential value to the data structure state. Amortized cost = actual cost + change in potential.
Non-negative potential and zero initial potential ensure total actual cost is bounded by total amortized cost.
Q12: Which recurrence cannot be solved directly by the standard Master Theorem?
A. T(n) = 3T(n/2) + O(n2)
B. T(n) = 2T(n/2) + O(n log n) [CORRECT]
C. T(n) = 4T(n/2) + O(n)
D. T(n) = T(n/2) + O(1)
Correct Answer: B
Rationale: The Master Theorem requires f(n) to be polynomial in nlog_b(a). For 2T(n/2)+O(n log n), nlog_2(2)=n, and n log n is not a simple
polynomial multiple of n, violating the regularity condition.
Section 2: Abstract Data Types and Collections
Q13: Which ADT is best suited for a browser's back-button?
A. Queue
B. Stack [CORRECT]
C. Priority Queue
D. Deque
Correct Answer: B
Rationale: A stack follows LIFO ordering, matching browser back-button behavior: the most recently visited page is returned to first. A
queue uses FIFO, returning to the first page, not the most recent.
Q14: In Java, what is the time complexity of contains() on a HashSet?
A. O(n)
B. O(log n)
C. O(1) average, O(n) worst-case [CORRECT]
D. O(n log n)
Correct Answer: C
Rationale: HashSet uses hash tables, providing O(1) average-case lookup. In the worst case where all elements hash to the same bucket, it
degrades to O(n). TreeSet guarantees O(log n) with its red-black tree.
100% Correct | Grade A | Verified Answers Page 3