Build a Sorting Visualizer - Build a Sorting Visualizer

As described here:

The Bubble Sort algorithm sorts a sequence of integers by comparing couples of adjacent elements starting from the beginning of the sequence. If the first element is greater than the second one, it swaps them. Then, it proceeds with the following couple. When the last element of the sequence is reached, it starts a new cycle from the beginning of the sequence, and repeats the process until the elements are sorted. The algorithm stops after one cycle completes with no swaps.

you need to compare all the pairs at each cycle
and then stop once there is a cycle with no swaps

you can see it in the example app if you need a visual example

Thanks for the tip. finally breakthrough it. Thanks alot!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.