0% found this document useful (0 votes)
4 views1 page

Sorting Temperature Differences in Rows

The document describes steps to sort values of temperature differences placed in 6 vertical rows using bubble sort. It involves comparing values in each row to those below it and swapping if out of order, repeating for each row until sorted.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Sorting Temperature Differences in Rows

The document describes steps to sort values of temperature differences placed in 6 vertical rows using bubble sort. It involves comparing values in each row to those below it and swapping if out of order, repeating for each row until sorted.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Step 1=>Start

Step 2 =>Create a box which contains N=6 vertical rows.

Step 3=>Place the values of temperature differences in these 6 rows.

Step 4=>Read the values in the rows N=1, N=2, N=3, N=4, N=5 and N=6. For N=0, there are no values
read.

Step 5=>Compare the value in row N=1 with the other values in rows N=2, N=3, N=4, N=5 and N=6.

Step 6=>If the value is smaller than the other values , the position of the value remains same or else
it is swapped with the other values.

Step 7=>Repeat Step 4 and Step 5 until there are no swaps for the value in N=1 . Then enter the next
row N=2.

Step 8=>Compare the value in row N=2 with the other values in rows N=3, N=4, N=5 and N=6.

Step 9=>Repeat Step 5 until there are no swaps for the value in N=2 . Then enter the next row N=3.

Step 10=>Compare the value in row N=3 with the other values in rows N=4, N=5 and N=6.

Step 11=> Repeat Step 5 until there are no swaps for the value in N=3. Then enter the next row N=4.

Step 12=>Compare the value in row N=4 with the other values in rows N=5 and N=6.

Step 13=>Repeat Step 5 until there are no swaps for the value in N=4. Then enter the next row N=5.

Step 14=>Compare the value in row N=5 with the value in row N=6.

Step 15=>If the value is smaller than the other value, the position of the value remains same or else
the values are swapped.

Step 16=>Print the values once there are no swaps from N=1 to N=6.

Step 17=>Stop

You might also like