Learn practical skills, build real-world projects, and advance your career

Sorting Algorithms

 
arr = [2,7,3,9,1,6]
arr[1],arr[1+1] = arr[1+1],arr[1]
arr
[2, 3, 7, 9, 1, 6]
arr1 = [2,3,7,9,1,6]
arr2 = [9,8,7,6,5,4]

Bubble Sort:

Compare and swap: