Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 34 pages
Exam (elaborations)

ESTHER PARK FOCUSED EXAM ACTUAL TEST PAPER QUESTIONS CORRECT ANSWERS GRADED A

Document preview thumbnail
Preview 4 out of 34 pages

ESTHER PARK FOCUSED EXAM ACTUAL TEST PAPER QUESTIONS CORRECT ANSWERS GRADED A

Content preview

ESTHER PARK FOCUSED EXAM ACTUAL TEST PAPER QUESTIONS CORRECT ANSWERS
GRADED A PLUS




Question:
master theorem.

Answer:
-if f(n) = O n^(logba -∈) for some const ∈>0 then T(n) =θn^(logb a) if f(n) =θn^(log b a ) then
T(n)=θn^(logba) logn if f(n) =Ω(n^logba + ε) for some constant ε>0 and if af(n/b) ≥ cf(n) for some
constant c<1 and all sufficiently large n, then T(n) = θf(n) f(n) dominates g(n) iff grows
polynomially faster than g(n). this is a stronger condition than f(n) = ωg(n) does not apply for the
gap between the tree cases (little o and little omega)



Question:
when master theorem does not apply.

Answer:
a must be >= 1, b must be >1 (they don't necessarily need to be integers) can check this by the limit
test and leaving the + ∈ and if there is not an ∈ you can pick to make it polynomially faster, then the
rule does not apply f(n) is negative ex. nlogn / n^1+e cuz both have n^1 in it if a = 2^n (cuz not
constant) if constant work is subtracted



Question:
polynomially larger? n^2 vs. n.

Answer:
yes



Question:
polynomially larger? n^2logn vs. n^2.

,Answer:
no



Question:
polynomially larger? n^3 log n vs. n^2.

Answer:
yes



Question:
polynomially larger? n^2.001 vs. n^2.

Answer:
yes



Question:
polynomially larger? nlogn vs. n^log4 3.

Answer:
yes



Question:
applying the master theorem given recurrences.

Answer:
coefficient is a, division is b and function is constant work compare n^logb a vs. f(n)



Question:
special rules for master theorem.

Answer:

,-case 2 only: this happens when log_b a is equal to the degree of n in f(n). if there is no log then
master method does not apply. if there is a log, look at the power. if the power of the log is > -1, then
T(n) = theta log _ b a * log^k+1 n where k is the power of the log if the power of the log = -1 then
T(n) = theta log_ b a log log n if the power of the log < -1 then T(n) = theta log_ b a



Question:
proof by induction on the binary search.

Answer:
base case: on the 0 iteration, x exists in A or x never existed in A at all inductive hypothesis: x exists
in A iff x lies in the subarray A[L.H] inductive step: if(A[mid] <= x) L<- mid else H<- mid-1 if
A[L] = x return L



Question:
heap sort.

Answer:
insert n inputs into the heap. call extractmin n times. values sorted least to greatest



Question:
merge sort.

Answer:
based on linear merge of 2 sorted arrays. divide and conquer algorithm



Question:
selection sort.

Answer:
goes thru and finds the smallest element and brings it to the front of the array



Question:

, running time of bubble sort.

Answer:
n^2



Question:
insertion sort running time.

Answer:
n^2



Question:
shell sort running time.

Answer:
n^2 or n^4/3 or n log^2n



Question:
quick sort running time.

Answer:
n log n



Question:
model of computation.

Answer:
what we can do in constant time. sorting algorithm can only do limited work in constant time. they
can make limited decisions about their inputs in constant time



Question:
limited decisions for sorting.

Document information

Uploaded on
August 15, 2026
Number of pages
34
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$17.89

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
1
Followers
0
Items
3365
Last sold
3 weeks ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions