Computer Science > ANSWERS AND COMMENTARIES > CS566_Final_Exam Boston University MET CS 566 (All)
Final Exam Fall 2021 ____________________________________________________________________________________ CS566 A1 Final Exam Due – Dec 15, 2021, 6:00 PM Student’s Name: Mohamed Aboulela Al... l work must be your own. No extensions or late submissions for anything. (1) [5 pts.] A graph with n nodes is connected, undirected, and acyclic. How many edges must it have? Select the answer from the following options and prove your choice. a) n b) n*(n-1) c) n - 1 d) n/2 – 1 Answer: c) n – 1. This is the answer because any connected and undirected graph with an n number of nodes and doesn’t have any cycle is a tree and a tree over n always has n – 1 edges. (2) [10 pts.] Which Design Technique was used to produce Kruskal's Algorithm? Select the answer from the following options and explain your choice: a) Dynamic Programming b) Greedy c) Divide and Conquer d) Linear Programming Answer: b) Greedy. This is because any algorithm related to Prim and Kruskal are greedy algorithms. In a Kuskal algorithm, in order to find the MST, the edge with the least weight is selected greedily. (3) [25 pts.] Given this method: METHOD math1: public int math1( int n ) { if (n < 1) { return 0; } // if [Show More]
Last updated: 1 week ago
Preview 4 out of 11 pages
Loading document previews ...
Buy this document to get the full access instantly
Instant Download Access after purchase
Add to cartInstant download
We Accept:
Connected school, study & course
About the document
Uploaded On
Jun 22, 2024
Number of pages
11
Written in
This document has been written for:
Uploaded
Jun 22, 2024
Downloads
0
Views
10
In Browsegrades, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Browsegrades · High quality services·