Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Data Structures II - Graph Traversals Homework 7, Assignments of Algorithms and Programming

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

Pre 2010

Uploaded on 08/16/2009

koofers-user-l9m
koofers-user-l9m 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CScD-327, Data Structures II
Homework 7: Graph Traversals
Due: Friday, 16 March 2007
Name: Use this assignment sheet as coversheet for hand-in
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 Gin 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.
2
1
1
1
2
1
2
1
2
1
1
A
B
C
D
E
F
G
1
2
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:49

Partial preview of the text

Download Data Structures II - Graph Traversals Homework 7 and more Assignments Algorithms and Programming in PDF only on Docsity!

CScD-327, Data Structures II

Homework 7: Graph Traversals

Due: Friday, 16 March 2007

Name: Use this assignment sheet as coversheet for hand-in

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.

A

B C

D

E F

G

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: