list = [3,1,2,4,2]
easiest sort algorithm ever seen
for i loop list {
for j loop list - i {
// i = 0
// j = 0,1,2,3,4
// this calculate the max value and push to last
// eg [1,2,3,2,4]
// second most
//i = 1
// j = 0,1,2,3 // got max value so no use of last index
// find second most
// eg [1,2,2,3]
}
}
Top comments (0)