• 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 3 out of 21 pages
Exam (elaborations)

Cs6515 Exam 2 2026/2027 Actual Questions With Verified Answers.

Document preview thumbnail
Preview 3 out of 21 pages

CS6515 EXAM 2 2026/2027 ACTUAL QUESTIONS WITH VERIFIED ANSWERS.

Content preview

CS6515 EXAM 2 2026/2027
ACTUAL QUESTIONS WITH
VERIFIED ANSWERS.

BFS Algorithm - correct answer -Input: Directed or Undirected
Graph G, and start vertex s


Output:
1. dist[u] - distance from s to u if s can reach u, inf otherwise
2. prev[z] - the parent index of vertex z


Runtime: O(m+n)


- Use this for unweighted Single Source Shortest Path
- Dist is given as the number of edges from s to u, not the sum of
weights




DFS Algorithm - correct answer -Input: Graph G


Output:
1. prev[z] - parent index of vertex z

,2. pre[z] - pre number of vertex z
3. post[z] - post number of vertex z
4. ccnum[z] - connected component number of z


Runtime: O(m+n)




Dijkstra's Algorithm - correct answer -Input: Graph (directed/un-
directed), Start vertex.


Output:
1. dist[u] - distance from s to u if s can reach u
2. prev[z] - parent index of vertex z


Runtime: O( (n + m) * log(n) )


More sophisticated BFS that utilizes miniheap data structure.
Such requires an additional log(n) time over BFS because of this




SCC Algorithm - correct answer -Input: Directed Graph


Output:
1. Metagraph of G.

, 2. Connected Component Numbers for each vertex (this comes
from DFS, explained above)


Runtime: O(n + m)




Kruskal Algorithm - correct answer -Input: connected undirected
graph G, edge weights w


Output: minimum spanning tree defined by the edges


Runtime: O(m log(m)) or O(m log(n))
Input: Connected, undirected graph. (Must have edge weights...
basis of algo)




How it works: Basically Sorts edges from least to greatest and
starts building the tree.




Prim's Algorithm - correct answer -Runtime: O(m log(m)) or O(m
log(n))
Input: Connected, undirected graph. (Must have edge weights...
basis of algo)
Output: The Minimum Spanning Tree of the graph.

Document information

Uploaded on
September 29, 2026
Number of pages
21
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$16.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.
Savvynurse
3.6
(58)
Sold
256
Followers
7
Items
7863
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