TORONTO KIDS COMPUTER CLUB | PMCA Sunday 12:00 Java Homework 20.02.16.
17098
post-template-default,single,single-post,postid-17098,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.8.0,vc_responsive

PMCA Sunday 12:00 Java Homework 20.02.16.

20 Feb PMCA Sunday 12:00 Java Homework 20.02.16.

Problem Description

Find the shortest distance between any two vertices in the graph:

The input contains two integers which contain the  starting node and the ending node. The output should contain the distance between two nodes

Sample Input 1:
0
5

Sample Output 1:
9

Explanation:
Shortest between nodes 0 and 5 is 9. The route is 0-2-3-5


Sample Input 2:
4
5

Sample Output 2:
3

Explanation:
Shortest between nodes 4 and 5 is 3. The route is 4-3-5


You can download starting code by clicking the following link:

shortest.java

if the file does not show up, please reload the page.

No Comments

Sorry, the comment form is closed at this time.