Given:
Goal:
Solution:
Assuming the numbers to be sorted are 7,1,3,6
Step 1: Take the first two numbers 7 and 1. Using your so called "block" gives smaller number as 1 and big number as 7. So swap the two numbers we get sequence as 1, 7, 3, 6.
step 2: Now move to numbers 7 and 3, give this as input to your block. big number is 7 and small is 3. So replace the positon of two numbers we get sequence as 1, 3, 7, 6.
step 3: Give the input to the block next two numbers 7 and 6. find which is greater and smaller. swap it to give the output 1,3,6,7.
Output:
Using your block we have sorted the given sequence in ascending order 1, 3, 6,7.