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
Exam (elaborations)

CMSC 132 Exam review (2026) Exam Questions & Answers | Latest Already Graded A+ UPDATE 2025|2026!! STUDY GUIDE EXAM

Rating
5.0
(1)
Sold
-
Pages
45
Grade
A+
Uploaded on
04-07-2026
Written in
2025/2026

CMSC 132 Exam review (2026) Exam Questions & Answers | Latest Already Graded A+ UPDATE 2025|2026!! STUDY GUIDE EXAM

Institution
CMSC 132
Course
CMSC 132

Content preview

CMSC 132 Exam review (2026) Exam Questions & Answers | Latest Already
Graded A+ UPDATE 2025|2026!! STUDY GUIDE EXAM




Analyzing runtime



Insert element into position 0 of an array of size n (in java) - (ANSWER)Runs in linear time, (if the array is
size n and you double it, time will be doubles as well, this is a good way to think about linear time).



Analyzing runtime



Retrieving an element from an array of size n (at a particular index, in java). - (ANSWER)When the CPU
has to do the arithmetic to get the element from the specified index, it's a constant time operation. The
arithmetic barley takes any time regardless of what index it is asking for.



(note: the size of arrays in java are bounded to 2^32)



Analyzing runtime



Program that prints all of the n-digit numbers - (ANSWER)It is an exponential function multiplied by a
linear function.



Think about 2 parabolas where one is shallow and the other is steep.

Can we make the shallow one worse than the steep one by multiplying it by a large constant? -
(ANSWER)- Yes, all parabolas are in the same "ballpark."

- It doesn't matter if one parabola starts better by the other, if you multiply it by a big enough number, it
is the same thing.



Imagine a parabola and a shallow line where the line is clearly faster, what if we start multiplying it? will
the line still be better? - (ANSWER)- Multiplying does slow it down but even when we multiply by a large
number, after the crossover we still see that the red line is faster.

- As n goes to infinity, there is no way u can multiply the line by a number and make it worse.

,CMSC 132 Exam review (2026) Exam Questions & Answers | Latest Already
Graded A+ UPDATE 2025|2026!! STUDY GUIDE EXAM




- Conclusion: lines are better/faster than parabolas.



f(n) as O(g(n)) means: - (ANSWER)As n goes toward infinity, f is either better, (faster/smaller) than g, or
"in the same ballpark."



What does "In the same ballpark" mean? - (ANSWER)- Even though g might seem better (smaller), we
can multiply it by a big number and make it worse (bigger) than f(for big values of n).

- We can find a big enough value m, so that f(n) < mg(n) for sufficiently large n.



On a test Fawzi may ask: show 3n^2 + 15n + 20 is O(n^2)



How would you show that? - (ANSWER)- Determine what number to multiply by n^2 to show that it can
be worse than the first function.

- answer: "I choose the multiplier n = 4, now 3n^2 + 15n + 20 < m(n^2) as long as n > 20.



Show 100n + 150 is O(n) - (ANSWER)- Keep plugging numbers into n until you could prove the answer is
true.

- I choose m = 101

- Now 100n + 150 < m(n) as long as n > 1000



What is the big O of the binary search algorithm? - (ANSWER)O(log n)



If f is linear and g is quadratic, - (ANSWER)then f is O(g) but g is NOT O(f)



If f is linear and g is logarithmic, - (ANSWER)then f is NOT O(g) but g IS O(f)



if f(n) = 2^n and g(n) = 3^n, - (ANSWER)then f is O(g) but g is not O(f)

,CMSC 132 Exam review (2026) Exam Questions & Answers | Latest Already
Graded A+ UPDATE 2025|2026!! STUDY GUIDE EXAM




f is O(g) meaning - (ANSWER)- f is either better (smaller) than g or at least not dramatically worse.

- this is big O notation



f is o(g) meaning - (ANSWER)f is dramatically better (smaller) than g.



Suppose we have two functions, f(n) and g(n), and we want to know: Are they "in the same ballpark"? if
not, which one is better/worse?



evaluate this limit:

lim (f(n)/g(n))

n --> infinity



What does it mean if this limit comes out as 0? - (ANSWER)If this limit comes out as zero that means
whatever is in the denominator is getting bigger dramatically faster than whatever is on top, so f is faster.
We can write this in little o notation:

f(n) is o(g(n))



Suppose we have two functions, f(n) and g(n), and we want to know: Are they "in the same ballpark"? if
not, which one is better/worse?



evaluate this limit:

lim (f(n)/g(n))

n --> infinity

What does it mean if this limit diverges? (goes to infinity) - (ANSWER)If the limit diverges (goes to
infinity) f is growing much faster so in little o notation we would write:

g(n) is o(f(n))

, CMSC 132 Exam review (2026) Exam Questions & Answers | Latest Already
Graded A+ UPDATE 2025|2026!! STUDY GUIDE EXAM




Suppose we have two functions, f(n) and g(n), and we want to know: Are they "in the same ballpark"? if
not, which one is better/worse?



evaluate this limit:

lim (f(n)/g(n))

n --> infinity

What does it mean if this limit equals a non zero constant? - (ANSWER)f(n) is theta(g(n))



(check lecture 40 for theta notation)



Analyzing code fragments



for (int i= 0; i< n; i++) {

System.out.println("Hi");

} - (ANSWER)O(n)



Analyzing code fragments



for (int i= 0; i< 100 * n; i++) {

System.out.println("HI");

} - (ANSWER)O(n)



Analyzing code fragments



for (int i= 0; i< n; i++) {

Written for

Institution
CMSC 132
Course
CMSC 132

Document information

Uploaded on
July 4, 2026
Number of pages
45
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$21.99
Get access to the full document:

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

Reviews from verified buyers

Showing all reviews
1 day ago

5.0

1 reviews

5
1
4
0
3
0
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
AlphaDocs Teachme2-tutor
View profile
Follow You need to be logged in order to follow users or courses
Sold
2181
Member since
4 months
Number of followers
7
Documents
608
Last sold
1 day ago

5.0

501 reviews

5
490
4
7
3
3
2
1
1
0

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