APCS/12 Graphs/65 Island Ferries/IslandFerries.java
Rushil Umaretiya 3fc3554899 initial commit
2020-12-04 22:00:49 -05:00

84 lines
2.8 KiB
Java

// Name:
// Date:
import java.awt.Point;
import java.util.HashMap;
import java.util.Set;
class Island implements Comparable<Island>
{
private int minDistance;
private final Point loc;
private HashMap<Island, Island> adj;
private int dists[];
/* student code goes here */
}
public class IslandFerries
{
public static void main(String[] args)
{
/* Example 0 */
String[] legs ={ "0-1 0-3", "0-2" };
String[] costs ={ "5 7", "1000 1000", "1000 1000", "1000 1000" };
/* Returns: { 5, 7, 5 } */
/* Example 1 */
//String[] legs = { "0-1 1-2 2-3", "0-1 2-3" };
//String[] costs = { "1 10", "20 25", "50 50", "1000 1000", "1000 1000" };
/*Returns: { 1, 11, 31, -1 } */
/* Example 2 */
//String[] legs = { "0-1", "1-0", "0-2", "2-3" };
//String[] costs = { "1 1 1000 1000", "1000 1000 10 100", "1000 1000 1000 1000", "1000 1000 1000 1000" };
/*Returns: { 1, 12, 112 }*/
/* Example 3 */
// String[] legs = { "1-0" };
// String[] costs = { "793", "350" };
/*Returns: { -1 } */
/*Example 4 */
// String[] legs = {"8-18 4-11 15-5 7-12 11-8 0-15 15-2 3-11 4-18 2-3",
// "16-2 18-3 15-18 11-19 18-2 18-7 19-17 3-15 12-19",
// "2-17 0-12 1-2 14-12 6-2 4-2 11-5 4-11 11-6 17-16",
// "0-18 13-18 16-0 3-7 14-12 3-1 19-18 3-19 10-3 8-15",
// "18-19 3-16 13-6 0-19 12-14 5-17 1-12 7-13 9-14 1-2",
// "14-5 17-9 2-10 16-13 11-15 10-17 14-10 0-14 2-13",
// "4-5 0-17 6-9 17-7 12-6 5-6 6-18 10-18 0-2 13-0 8-4",
// "3-12 4-11 10-17 13-12 3-0 3-7 13-0 9-15 10-9 0-10" };
// String[] costs = {"592 219 88 529 324 86 503 610",
// "2 94 8 600 34 95 6 494",
// "638 301 10 246 290 97 85 74",
// "118 8 939 393 450 79 317 99",
// "99 806 698 740 2 26 525 818",
// "95 9 615 972 23 23 5 666",
// "6 448 440 710 83 4 419 496",
// "4 47 182 4 185 70 718 770",
// "3 321 6 855 968 65 10 6",
// "173 224 300 3 79 2 707 49",
// "21 10 7 10 4 9 5 8",
// "6 600 4 724 7 1 960 247",
// "83 16 901 50 437 780 658 2",
// "763 923 125 576 45 423 3 1",
// "7 324 391 898 8 59 281 973",
// "9 44 49 364 78 744 43 5",
// "10 62 75 418 216 90 32 919",
// "764 534 778 605 80 647 821 74",
// "65 449 102 867 421 94 6 7",
// "67 155 362 789 189 316 107 595" };
/*Returns: { 170, 160, 155, 173, 145, 150, 158, 168, 153, 145, 162, 88, 162, 86, 163, 159, 153, 150, 104 }
*/
}
public static int[] costs(String[] legs, String[] costs)
{
int[] toReturn = null;
/* student code goes here */
return toReturn;
}
}