CPS 49S: jawaa sorting

Angie Berg and Sharon Edwards



We will look for the tallest rectangle. Then, we will trade its position with that of the last rectangle.

Then, we will look for the tallest rectangle, excluding the last one. Then we will trade its position with that of the ninth rectangle.

We will repeat this step, considering the next rectangle to the left and the tallest rectangle that has not been placed in a position to the right of the rectangle it is being compared to.