-
Notifications
You must be signed in to change notification settings - Fork 0
/
Derrick_lab2.m
76 lines (67 loc) · 1.53 KB
/
Derrick_lab2.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
% Programmer: Derrick Beckler
close all;
clear all;
x = inf;
% Replace C with your Matrix
% Program is not limited by set Matrix size
C = [0 1 5 2 x x;
1 0 2 6 x x;
5 2 0 1 3 x;
2 6 1 0 x 4;
x x 3 x 0 1;
x x x 4 1 0;];
visited = [1:length(C)];
notVisited = [0:length(C)];
i = 1;
idx = 2;
while(i<length(C))
notVisited(i) = (i+1);
i = i+1;
end
notVisted
% lengthRow = length(C);
% newTable = C;
% i=0;
% j=0;
% row=1;
% idxPos = 2;
% vect1 = C(row,:);
% vectTemp = C(row,:);
% while i<lengthRow
% while j<lengthRow
% [a,b] = min(vect1);
% if (a==0)
% vect1(b) = y;
%
% else
% vect2 = C(b,:);
% source = vect2(row);
% idxPos = 2;
%
%
% while idxPos<=lengthRow
% if source+vect2(idxPos) < vectTemp(idxPos)
% vectTemp(idxPos) = source+vect2(idxPos);
% idxPos = idxPos+1;
% else
% idxPos = idxPos+1;
% end
% C(:,row) = vectTemp;
% C(row,:) = vectTemp;
%
% end
% newTable(row,:) = vectTemp;
%
% vect1(b) = y;
% end
% j = j+1;
% end
% if (row<lengthRow)
% row = row+1;
% vect1 = C(row,:);
% vectTemp = C(row,:);
% end
% i = i+1;
% j=0;
% end
% newTable