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

CS 6515 Final Questions and Correct Answers the Latest Update

Document preview thumbnail
Preview 2 out of 11 pages

Quick Sort Runtime O(n^2) O(nlogn) with median of medians Merge Sort Runtime O(nlogn) Quick Select Runtime O(n^2) O(n) with median of medians (Fast select) Dijkstra's algorithm An algorithm for finding the shortest paths between nodes in a weighted graph. For a given source node in the graph, the algorithm finds the shortest path between that node and every other. It can also be used for finding the shortest paths from a single node to a single destination node by stopping the algorithm once the shortest path to the destination node has been determined. Its time complexity is O(E + VlogV), where E is the number of edges and V is the number of vertices. - uses min-heap (prio-queue) - O((n+m) log n) - O(m log n) - strongly connected - prev(u) Examify | OnlineExams | TestPrep | StudyResources | AcademicSuccess | ExamPreparation | QuizTime | LearningTools | Education | StudentSupport Smart Grades Latest update 1 Kruskal's Algorithm (Minimum Spanning Trees, O(mlogn) with a union find, which is fast for sparse graphs) Builds up connected components of vertices, repeatedly considering the lightest remaining edge and tests whether its two endpoints lie within the same connected component. If not, insert the edge and merge the two components into one. input: undirected G=(V,E) with weights w(e) 1. sort E by incr weight (O(mlogn)) 2. set X = empty set 3. for e = (v, w) exists E (go through in order) if x Ue doesnt have a cycle then: X = X U e(checks if v and w are in different components: O(log n)) 4. return X returns MST defined by edges X Prim's Algorithm for MST Start with a node and add edge with the lowest weight. Then from the current existing nodes add the next smallest edge that exists going out from all the existing nodes. Do this until all vertices are connected. - min spanning tree defined by array prev[] - O(m log n) Ford-Fulkerson Algorithm Runtime: O(mC)Input: Graph with integer edge weights. (Note: Does not work with Infinity)Output: max flow f* 1. set f_e = 0 for all edges Examify | OnlineExams |

Content preview

Examify | OnlineExams | TestPrep | StudyResources | AcademicSuccess |
ExamPreparation | QuizTime | LearningTools | Education | StudentSupport



CS 6515 Final Questions and Correct
Answers the Latest Update
Quick Sort Runtime

✓ O(n^2)
✓ O(nlogn) with median of medians



Merge Sort Runtime

✓ O(nlogn)



Quick Select Runtime

✓ O(n^2)
✓ O(n) with median of medians (Fast select)



Dijkstra's algorithm

✓ An algorithm for finding the shortest paths between nodes in a weighted graph. For
a given source node in the graph, the algorithm finds the shortest path between
that node and every other. It can also be used for finding the shortest paths from a
single node to a single destination node by stopping the algorithm once the shortest
path to the destination node has been determined. Its time complexity is O(E +
VlogV), where E is the number of edges and V is the number of vertices.
✓
✓ - uses min-heap (prio-queue)
✓ - O((n+m) log n)
✓ - O(m log n) - strongly connected
✓
✓ - prev(u)




Smart Grades Latest update
1

, Examify | OnlineExams | TestPrep | StudyResources | AcademicSuccess |
ExamPreparation | QuizTime | LearningTools | Education | StudentSupport

Kruskal's Algorithm

✓ (Minimum Spanning Trees, O(mlogn) with a union find, which is fast for sparse
graphs) Builds up connected components of vertices, repeatedly considering the
lightest remaining edge and tests whether its two endpoints lie within the same
connected component. If not, insert the edge and merge the two components into
one.
✓
✓ input: undirected G=(V,E) with weights w(e)
✓ 1. sort E by incr weight (O(mlogn))
✓ 2. set X = empty set
✓ 3. for e = (v, w) exists E (go through in order)
✓ if x Ue doesnt have a cycle
✓ then: X = X U e(checks if v and w are in different components: O(log n))
✓ 4. return X
✓
✓ returns MST defined by edges X



Prim's Algorithm for MST

✓ Start with a node and add edge with the lowest weight. Then from the current
existing nodes add the next smallest edge that exists going out from all the existing
nodes. Do this until all vertices are connected.
✓
✓ - min spanning tree defined by array prev[]
✓ - O(m log n)



Ford-Fulkerson Algorithm

✓ Runtime: O(mC)Input: Graph with integer edge weights. (Note: Does not work with
Infinity)Output: max flow f*
✓
✓ 1. set f_e = 0 for all edges

Smart Grades Latest update
1

Document information

Uploaded on
October 21, 2024
Number of pages
11
Written in
2024/2025
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.
Passit
3.5
(23)
Sold
135
Followers
6
Items
14453
Last sold
1 week 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