Enhanced Bubble Sort - Sorting Algorithm in Python Programming language

preview_player
Показать описание
Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted. The algorithm, which is a comparison sort, is named for the way smaller elements "bubble" to the top of the list. Although the algorithm is simple, it is too slow and impractical for most problems even when compared to insertion sort.[1] It can be practical if the input is usually in sort order but may occasionally have some out-of-order elements nearly in position.
Рекомендации по теме
Комментарии
Автор

nice video, for swapping you could have done numbers[j], numbers[j+1] = numbers[j+1], numbers[j]

parnabsanyal
Автор

Very nice presentation and explanation. Hope to see more from you.

redserpent
join shbcf.ru