Computer Science > QUESTIONS & ANSWERS > University of Maryland, College Park CMSC 351 hwk9-sol-ALL ANSWERS CORRECT-GRADED A (All)

University of Maryland, College Park CMSC 351 hwk9-sol-ALL ANSWERS CORRECT-GRADED A

Document Content and Description Below

CMSC351 (Kruskal) Homework 9 Due: Wednesday, July 5, 2017 Problem 1. Let G = (V; E) be a directed graph. (a) Assuming that G is represented by an adjacency matrix A[1::n; 1::n], give a Θ(n2)-time ... algorithm to compute the adjacency list representation of G. (Represent the addition of an element v to a list l using pseudocode by l l [ fvg.) Solution: This procedure runs through the adjacency matrix looking for 1’s. Clearly this is Θ(n2). for x := 1 to n do Adj[x] empty list; for x := 1 to n do for y := 1 to n do if A[x; y] = 1 then Adj[x] Adj[x] [ fyg; (b) Assuming that G is represented by an adjacency list Adj[1::n], give a Θ(n2)-time algorithm to compute the adjacency matrix of G. Solution: This procedure runs through the adjacency list and sets the 1’s in the adjacency matrix. The Θ(n2) term comes from initiallizing the adjacency matrix. for x := 1 to n do for y := 1 to n do A[x; y] := 0; for x := 1 to n do for each y in Ad [Show More]

Last updated: 2 years ago

Preview 1 out of 2 pages

Buy Now

Instant download

We Accept:

We Accept
document-preview

Buy this document to get the full access instantly

Instant Download Access after purchase

Buy Now

Instant download

We Accept:

We Accept

Reviews( 0 )

$6.00

Buy Now

We Accept:

We Accept

Instant download

Can't find what you want? Try our AI powered Search

73
0

Document information


Connected school, study & course


About the document


Uploaded On

May 03, 2021

Number of pages

2

Written in

Seller


seller-icon
d.occ

Member since 4 years

232 Documents Sold

Reviews Received
30
8
4
1
7
Additional information

This document has been written for:

Uploaded

May 03, 2021

Downloads

 0

Views

 73

Document Keyword Tags


$6.00
What is Scholarfriends

In Scholarfriends, 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 are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Scholarfriends · High quality services·