https://visualgo.net/en/sorting
7 VisuAlgo.net / /sortingBUBBLE SORT SEL INS MER QUI R-Q COU RAD
Set the swapped flag to false.
Then iterate from index 1 to 14 inclusive.
do
swapped = false
for i = 1 to indexOfLastUnsortedElement-1
if leftElement > rightElement
swap(leftElement, rightElement)
swapped = true; ++swapCounter
while swapped
No hay comentarios:
Publicar un comentario