• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 6 pages
Exam (elaborations)

Algorithms Exam Questions and Answers Fully Solved Graded A+

Document preview thumbnail
Preview 2 out of 6 pages

Algorithms Exam Questions and Answers Fully Solved Graded A+ Definition of an algorithm - Answersa sequence of unambiguous instructions for solving a problem (for obtaining a required output for any legitimate input in a finite amount of time) Requirements of an algorithm - Answers- Non-ambiguity (set of steps) - Carefully specified range of inputs - Output must be correct for anything in that range - It has to be completed in a finite amount of time Misc algorithm stuff - Answers- Same algorithm can be represented in several different ways - Several algorithms for solving the same problem may exist - May have dramatically different speeds GCD (Euclids Alg) - Answersinput: two integers m and n, = 0 and not both 0 while n != 0 { r = m mod n m = n n = r } return m Steps for algorithm design - Answers1) Understand the problem 2) Figure out what your computer is capable of (sequential vs parallel) 3) Choose exact or approximate 4) Pick a data structure 5) Consider algorithm design techniques (Prove correctness, analyze algorithm, code it) Important problem types - Answers1) Sorting 2) Searching 3) String processing 4) Graph problems 5) Combinatorial 6) Geometric 7) Numeric Time Efficiency (Def) - AnswersHow fast an algorithm runs (easier to improve than space efficiency) Space Efficiency (Def) - AnswersHow much space an algorithm requires Basic Operation (Def) - AnswersThe most expensive most commonly used operation Order of Growth (order) - Answersc, log n, log (n^2), (log n) ^2, n^(1/3), n^(1/2), n, n (log n), n^2, n^3, 2^n, n! Is average case efficiency often (worst case + best case)/2? - AnswersNo Big Oh, O(g(n)) -meaning - AnswersSet of all functions with the same or smaller growth rates as g(n) Big Omega, Ω(g(n)) -meaning - AnswersSet of all functions with the same or greater growth rates than g(n) Big Theta, Θ(g(n)) -meaning - AnswersSet of all functions with the same order of growth as g(n) How do you prove big theta? - AnswersProve that big omega and big oh are of equal growth orders Big Oh, O(g(n)) -definition - Answersthere exists a positive constant (c) and a non-negative integer n0 such that

Content preview

Algorithms Exam Questions and Answers Fully Solved Graded A+

Definition of an algorithm - Answersa sequence of unambiguous instructions for solving a problem (for
obtaining a required output for any legitimate input in a finite amount of time)

Requirements of an algorithm - Answers- Non-ambiguity (set of steps)

- Carefully specified range of inputs

- Output must be correct for anything in that range

- It has to be completed in a finite amount of time

Misc algorithm stuff - Answers- Same algorithm can be represented in several different ways

- Several algorithms for solving the same problem may exist

- May have dramatically different speeds

GCD (Euclids Alg) - Answersinput: two integers m and n, >= 0 and not both 0



while n != 0 {

r = m mod n

m=n

n=r

}

return m

Steps for algorithm design - Answers1) Understand the problem

2) Figure out what your computer is capable of (sequential vs parallel)

3) Choose exact or approximate

4) Pick a data structure

5) Consider algorithm design techniques

(Prove correctness, analyze algorithm, code it)

Important problem types - Answers1) Sorting

2) Searching

, 3) String processing

4) Graph problems

5) Combinatorial

6) Geometric

7) Numeric

Time Efficiency (Def) - AnswersHow fast an algorithm runs (easier to improve than space efficiency)

Space Efficiency (Def) - AnswersHow much space an algorithm requires

Basic Operation (Def) - AnswersThe most expensive most commonly used operation

Order of Growth (order) - Answersc, log n, log (n^2), (log n) ^2, n^(1/3), n^(1/2), n, n (log n), n^2, n^3,
2^n, n!

Is average case efficiency often (worst case + best case)/2? - AnswersNo

Big Oh, O(g(n)) -meaning - AnswersSet of all functions with the same or smaller growth rates as g(n)

Big Omega, Ω(g(n)) -meaning - AnswersSet of all functions with the same or greater growth rates than
g(n)

Big Theta, Θ(g(n)) -meaning - AnswersSet of all functions with the same order of growth as g(n)

How do you prove big theta? - AnswersProve that big omega and big oh are of equal growth orders

Big Oh, O(g(n)) -definition - Answersthere exists a positive constant (c) and a non-negative integer n0
such that



t(n) <= c*g(n) for all n>= n0

Big Omega, Ω(g(n)) -definition - Answersthere exists a positive constant (c) and a non-negative integer
n0 such that



t(n) >= c*g(n) for all n>= n0

Big Theta, Θ(g(n)) -definition - Answersthere exists a positive constants (c1 and c2) and a non-negative
integer n0 such that

Document information

Uploaded on
August 3, 2025
Number of pages
6
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$10.99

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

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.
TutorJosh
3.5
(77)
Sold
508
Followers
16
Items
33081
Last sold
3 days 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