Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int FindMin(int roads[N][N],int i,int min,int lenght,int houses_visited[4])
- {
- if (check_full(houses_visited)==4 && i == 0){
- return lenght; // come in the if when its over but continue
- }
- if (check_full(houses_visited)==4 && i!= 0){
- return NO_PATH;
- }
- for (int j=0;j<N;j++) {
- if (roads[i][j] == -1 ||(houses_visited[j] == 1 && i!=3)|| i ==j){
- continue;
- }
- houses_visited[i] = 1;
- lenght = lenght + roads[i][j];
- FindMin(roads,j,min,lenght, houses_visited);
- houses_visited[i] = 0; // here
- lenght = lenght - roads[i][j];
- }
- return lenght;
- }
Add Comment
Please, Sign In to add comment