Analysis of Algorithms
Study Guide Time
Complexity and Algorithm
Design
Guidehttps://www.stuvia.com/dashboard!@_)#*)(@$)($@*($@)($@*_1 of 34
Page 1 of 34 Analysis of Algorithms Study Guide Time Complexity and Algorithm Design.pdf
,Analysis of Algorithms Page 2 2026-03-20
True/False: Is 2^(n+1) = O(2^n) ? False
3^n + 12 O(2^n)
Page 2 of 34 2 of 34 Analysis of Algorithms.pdf
,Analysis of Algorithms Page 3 2026-03-20
What is the Asymptotic complexity of a binary O(lg * n)
search given the code below and the following
recursion equation:
T(n) = T(n/2) + 1
// initially called with low = 0, high = N - 1
BinarySearch_Right(A[0..N-1], value, low, high) {
// invariants: value >= A[i] for all i < low
value < A[i] for all i > high
if (high < low)
return low
mid = (low + high) / 2
if (A[mid] > value)
return BinarySearch_Right(A, value, low, mid-1)
else
return BinarySearch_Right(A, value, mid+1, high)
}
Page 3 of 34 3 of 34 Analysis of Algorithms.pdf
, Analysis of Algorithms Page 4 2026-03-20
Given the following algorithm, what is the number 4+2n
of fundamental instructions that this routine will
execute if the value of n is 4?
var M = A[ 0 ];
for ( var i = 0; i < n; ++i ) {
if ( A[ i ] >= M ) {
M = A[ i ];
}
}
True/False: A Boolean variable can take on only 1 False
value.
Page 4 of 34 4 of 34 Analysis of Algorithms.pdf