Midterm 2 Solution

$35.00 $30.80

Description

  1. Write a program that computes the “diameter” of a directed graph which is defined as the maximum-length shortest path connecting any two vertices. Estimate the runtime of your algorithm. Feel free to use the following datasets:
    https://algs4.cs.princeton.edu/44sp/tinyEWD.txt
    https://algs4.cs.princeton.edu/44sp/mediumEWD.txt
    https://algs4.cs.princeton.edu/44sp/1000EWD.txt
    https://algs4.cs.princeton.edu/44sp/10000EWD.txt

 

 

 

  1. Compute the
    (i)number of connected components
    (ii)size of the largest component,
    (iii) number of components of size less than 10 for data provided at:
    https://algs4.cs.princeton.edu/41graph/movies.txt .