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
Material Type: Quiz; Professor: Padua-Perez; Class: OBJECT-ORIENTED PROG II; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;
Typology: Quizzes
1 / 2
CMSC 132 Quiz 4 Worksheet
The fourth quiz of the course will be on Monday, Nov 24 during your lab (discussion) session. The following list provides additional information about the quiz:
The quiz will be a written quiz (no computer). Closed book, closed notes quiz. Answers must be neat and legible. We recommend that you use pencil and eraser.
The following exercises cover the material to be included in this quiz. Solutions to these exercises will not be provided, but you are welcome to discuss your solutions with TAs and instructors.
UML Design
Graphs
Use the following graph for the questions below.
For each of the following exercises, specify the order nodes are visited when performing the appropriate traversal. Pick nodes to visit using alphabetical order (when multiple choices are possible).
a. Apply DFS with A as the start node. b. Apply DFS with C as the start node (assuming edges are undirected). c. Apply BFS with D as the start node. d. Apply BFS with F as the start node (assuming edges are undirected).
For each of the following exercises, assume that all edges are undirected. Apply Dijkstra’s algorithm. Indicate the cost (for lowest weight path) and predecessor for each node in the graph after completing the algorithm. Also list the order nodes are added to the set of processed nodes.
For instance, applying Djikstra’s algorithm with C as the start node yields (after C is processed):
Node A B C D E F Cost ∞ 1 0 25 ∞ 8 Predecessor none C none C none C Order added 1
And after all nodes are processed:
Node A B C D E F Cost 10 1 0 5 7 8 Predecessor E C none B D C Order added 6 2 1 3 4 5
The shortest path to A from C is thus C→B→D→E→A, with a cost of 10.
a. Apply Dijkstra’s algorithm with A as the start node. List shortest path to F. b. Apply Dijkstra’s algorithm with B as the start node. List shortest path to F. c. Apply Dijkstra’s algorithm with E as the start node. List shortest path to C.