100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

CS6515 - Algorithms- Exam 1 Questions and Answers Already Passed Latest 2025

Rating
-
Sold
-
Pages
13
Grade
A+
Uploaded on
02-06-2025
Written in
2024/2025

CS6515 - Algorithms- Exam 1 Questions and Answers Already Passed Latest 2025 Steps to solve a Dynamic Programming Problem - Answers 1. Define the Input and Output. 2. Define entries in table, i.e. T(i) or T(i, j) is... 3. Define a Recurrence relationship - Based on a subproblem to the main problem. (hint: use a prefix of the original input 1 < i < n). 4. Define the Pseudocode. 5. Define the Runtime of the algorithm. Use Time Function notation here => T(n) = T(n/2) + 1... DP: Types of Subproblems (4) - Answers Input = x1, x2, ..., xn 1) Subproblem = x1, x2, ..., xi ; O(n) 2) Subproblem = xi, xi+1, ..., xj ; O(n^2) Input = x1, x2, ..., xn; y1, y2, ..., ym 1) Subproblem = x1, x2, ..., xi; y1, y2, ..., yj ; O(mn) Input = Rooted Binary Tree 1) Subproblem = Smaller rooted binary tree inside the Input. DC: Geometric Series - Answers Given r = common ratio and a = first term in series => a + ar + ar^2 + ar^3 + ... + ar^(n-1) => a * [(1 - r^n) / (1-r)] DC: Arithmetic Series - Answers Given d = common difference and a = first term in series => a + (a + d) + (a + 2d) + ... + (a + (n-1)d Sum = n/2 * [2*a + (n-1)d] DC: Solving Recurrences - Master Theorem - Answers If T(n) = aT([n/b]) + O(n^d) for constants a>0, b>1, d>=0: T(n) = { O(n^d) if d > logb(a) O((n^d)logn) if d = logb(a) O(n^(logb(a))) if d < logb(a) } Nth roots of Unity - Answers (1, 2*PI*j/n) for j = 0, 1, ..., n-1 *Around the Unit Circle! Steps to solve for FFT - Answers 1) Write out Matrix Coefficient Form based on n (size of input) Mn(w) = [ 1 1 ... 1 1 w ... w^n-1 ... 1 w^n-1 ... w^((n-1)*(n-1)) ] 2) Find value for w = e^(2*PI*i)/n, Substitute in Mn(w). 3) For the input coefficients into nx1 matrix. I.E. [4 0 1 1], let known as B. 4) Evaluate FFT: a) FFT of Input = Mn(w) x B b) Inverse FFT of Input = 1/n * Mn(w^-1) x B Euler's Formula - Answers e^ix = cosx + isinx Imaginary Number Multiples - Answers i = i, i^2 = -1, i^3 = -i, i^4 = 1 i = -i, i^2 = -1, i^3 = i, i^4 = 1 Omega(w) - Answers w = (1, 2*PI / n) = e^(2*PI*i/n) DC Algorithms and Runtimes (6) - Answers MergeSort: O(nlogn) - Split the input array into two halves and recursively sort and merge at the end. QuickSort: O(nlogn) - Same splitting strategy as MergeSort.

Show more Read less
Institution
CS 6515
Course
CS 6515









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CS 6515
Course
CS 6515

Document information

Uploaded on
June 2, 2025
Number of pages
13
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

CS6515 - Algorithms- Exam 1 Questions and Answers Already Passed Latest 2025



Steps to solve a Dynamic Programming Problem - Answers 1. Define the Input and Output.



2. Define entries in table, i.e. T(i) or T(i, j) is...



3. Define a Recurrence relationship - Based on a subproblem to the main problem. (hint: use a prefix of
the original input 1 < i < n).



4. Define the Pseudocode.



5. Define the Runtime of the algorithm. Use Time Function notation here => T(n) = T(n/2) + 1...

DP: Types of Subproblems (4) - Answers Input = x1, x2, ..., xn

1) Subproblem = x1, x2, ..., xi ; O(n)

2) Subproblem = xi, xi+1, ..., xj ; O(n^2)



Input = x1, x2, ..., xn; y1, y2, ..., ym

1) Subproblem = x1, x2, ..., xi; y1, y2, ..., yj ; O(mn)



Input = Rooted Binary Tree

1) Subproblem = Smaller rooted binary tree inside the Input.

DC: Geometric Series - Answers Given r = common ratio and a = first term in series

=> a + ar + ar^2 + ar^3 + ... + ar^(n-1)



=> a * [(1 - r^n) / (1-r)]

, DC: Arithmetic Series - Answers Given d = common difference and a = first term in series => a + (a + d) +
(a + 2d) + ... + (a + (n-1)d



Sum = n/2 * [2*a + (n-1)d]

DC: Solving Recurrences - Master Theorem - Answers If T(n) = aT([n/b]) + O(n^d) for constants a>0, b>1,
d>=0:



T(n) = {

O(n^d) if d > logb(a)

O((n^d)logn) if d = logb(a)

O(n^(logb(a))) if d < logb(a)

}

Nth roots of Unity - Answers (1, 2*PI*j/n) for j = 0, 1, ..., n-1

*Around the Unit Circle!

Steps to solve for FFT - Answers 1) Write out Matrix Coefficient Form based on n (size of input) Mn(w) = [
1 1 ... 1

1 w ... w^n-1

...

1 w^n-1 ... w^((n-1)*(n-1)) ]



2) Find value for w = e^(2*PI*i)/n, Substitute in Mn(w).



3) For the input coefficients into nx1 matrix. I.E. [4 0 1 1], let known as B.



4) Evaluate FFT:

a) FFT of Input = Mn(w) x B

b) Inverse FFT of Input = 1/n * Mn(w^-1) x B

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.
TutorJosh Chamberlain College Of Nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
332
Member since
1 year
Number of followers
16
Documents
28288
Last sold
8 hours ago
Tutor Joshua

Here You will find all Documents and Package Deals Offered By Tutor Joshua.

3.6

53 reviews

5
18
4
14
3
12
2
0
1
9

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

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

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

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

Student with book image

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

Alisha Student

Frequently asked questions