Algorithm
Lets take an example suppose we have an array of size 8 bytes , Eg A[8]={12,3,1,5,8}
step 1: compare the first element of the array with the immediate next to it. Here compare 12 with 3, since 12 is greater than 3, we swap 12 with 3, then it becomes 3,12,1,5,8
Step 2: Then compare 1 with 12 since 12 is greater than swap it, and check whether 3 is greater than 1 since it is so the array becomes 1,3,12,5,8
Step 3: Repeat step 2 unitill we reach the last element of the array.