shlogg · Early preview
Hariprasath @hashiramasenjuhari

Easiest Sort Algorithm Ever Seen: Bubble Sort Implementation

Easiest sort algorithm ever seen. Iterate through list, for each element, find max value and push to last index, then find second max value.

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]
    }
}