Question 1
Which of the following statements about direct access in an array are correct?
All three statements A, B, and C are correct for a conventional array with constant-size elements. Therefore, more than one of the above is correct.
Which of the following statements about direct access in an array are correct?
All three statements A, B, and C are correct for a conventional array with constant-size elements. Therefore, more than one of the above is correct.
In a 0-indexed Column-Major ordered 2D array A[M][N] with base address B and element byte size W, what is the address formula for A[i][j]?
In Column-Major order, column j is preceded by j full columns of M elements each. Adding row offset i gives total offset = j * M + i.
According to the Master Theorem, what is the asymptotic solution to the recurrence relation T(n) = 2T(n/2) + O(n)?
Here $a = 2$, $b = 2$, and f(n) = O(n). Since $n^{log_b$ a} = $n^1$ = $n = f(n)$, this matches Case 2 of the Master Theorem, yielding T(n) = O(n log n).
What is the tightest upper bound time complexity for solving the recurrence T(n) = T(n-1) + O(1) with T(1) = O(1)?
Unrolling the recurrence T(n) = T(n-1) + c yields c + c + ... + c (n times), which evaluates to O(n).
Which sparse matrix representation stores only non-zero elements using 3-tuples containing (row_index, column_index, value)?
Triplet representation stores sparse matrices efficiently by maintaining a 3-column array of (row, col, value) for non-zero entries.