Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function A = selection(A)
- n = length(A);
- for i = 1:n
- index = i;
- for j = i+1:n
- if A(j) < A(index)
- index = j;
- endif
- endfor
- if index != i
- temp = A(index);
- A(index) = A(i);
- A(i) = temp;
- endif
- endfor
- endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement