RESOURCES 2026 DETAILED ANSWERS
PROVIDED
⫸ Big Ω notation. Answer: Ω(g(n)) = f(n) if f(n) >= a*g(n) while n
>= b
⫸ Big Θ notation. Answer: Θ(g(n)) = f(n) if f(n) <= a*g(n) and f(n)
>= b*g(n) for all n >= c
⫸ To prove correctness of algorithm, show ______, _____ and
_____ hold. Answer: initialization, maintenance, and termination
⫸ Index of left child of node. Answer: i = index of node
2*i = index of node's left child
⫸ parent index in heap. Answer: i = index of node
floor(i/2) = index of node's parent
⫸ What does heap-extract max do?. Answer: 1) takes out the head of
heap and replaces it with last node
2) performs max-heapify on head
, ⫸ Find the expression associated with the runtime of this
pseudocode (i.e. C1 x n + C2 x n ... etc) and find the big O
approximation
k=1 // C1
do // C2
{
j = 1 // C3
do // C4
{
j = j*2 // C5
}while(j < n) // C6
k++ // C7
}while (k < n) // C8. Answer: C1 x 1 + C2 x n + C3 x n + C4 x
n(log_2(n)) + C5 x n(log_2(n)) + C6 x n(log_2(n)) + C7 x n + C8 x n
= O(nlogn)
⫸ Time of max-heapify. Answer: O(logn)
⫸ O approximation of T(n) = T(n/2)+cn+b. Answer: O(nlogn)
⫸ What is the height of a heap?. Answer: The number of edges from
head to lowest node