
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Instructions for completing homework assignment cscd-327, data structures ii, where students are required to perform graph traversals using different algorithms such as depth-first, breadth-first, prim's algorithm, and kruskal's algorithm. The assignment includes a weighted graph with adjacency lists and requires students to show their work, including call stacks, queues, and min-heaps or sorted arrays for the traversals. An extra credit option is also available for dijkstra's algorithm.
Typology: Assignments
1 / 1
This page cannot be seen from the preview
Don't miss anything!
You are given the following weighted graph. Show (1) the order in which nodes will be visited
in a pre-order traversal that begins with A; and (2) the spanning tree generated by the traversal.
(There are 10 points per traversal, for a total of 30.)
(a) Depth-first — recursive implementation ( not the iterative/stack implementation )
(b) Breadth-first
(c) Prim's algorithm (priority-first traversal) for a minimum spanning tree OR
Kruskal’s algorithm (edge order: AE AG BC CD CF EF EG FG AB AC AD BF DF ),
expressly noting edges discarded as well as edges used.
Treat your adjacency lists as having the vertices in alphabetic order. Hence, for instance, A is
connected to B, C, D, E, and G — in that order. Hint : hence the first edge used in the recursive
depth-first and the breadth-first traversal is AB.
Note that weight information is ignored in the depth-first and breadth-first traversals.
You are required to show your work as you do the traversals — the call stack for the
depth-first, the queue for the breadth-first, and the min-heap (or sorted array / list) for Prim's
algorithm (priority-first traversal) — and for Dijkstra's algorithm if you hand in the extra credit
portion.
Extra credit option: Dijkstra’s algorithm for single-source shortest path spanning tree.
Again, you must show your work as you do the traversal
Note: Click here for Fall 2004's solution set — in Word document f006Frm.
Printed 05 December 2020 at 17: