We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8
1.
2. import java.util.Scanner;
public class SPT {
private int V; private char[] vertices;
SPT(int verticesCount) { V = verticesCount; vertices = new char[V]; }
int minDistance(int dist[], Boolean sptSet[]) {
int min = Integer.MAX_VALUE; int min_index = -1; for (int v = 0; v < V; v++) { if (sptSet[v] == false && dist[v] < min) { min = dist[v]; min_index = v; } } return min_index; }