Intro to Sorting Algorithms in Python - Bubble Sort

preview_player
Показать описание
Bubble Sort is one of the most straightforward sorting algorithms. Its name comes from the way the algorithm works: With every new pass, the largest element in the list “bubbles up” toward its correct position.

Bubble sort consists of making multiple passes through a list, comparing elements one by one, and swapping adjacent items that are out of order.

Рекомендации по теме
Комментарии
Автор

Understanding how to program sort algorithms is really good for people learning python or those going for a Developer interview where they ask python questions. Asking to program a sort method is a pretty common interview question.

DevOpsJourney
Автор

Hey Dan, I love what you're doing with your community!! Way to go :)

strategy_gal
Автор

So "for i in items" the i refers to indices? Oh my god I finally get it, thank you! They couldn't even explain it in college when I kept asking about it lol

bluesdog
Автор

Hey everyone, I tried using the timing decorator and it returns <built-in function perf_counter> rather than a time. The files timing.py and bubblesort.py are in the same folder. Any ideas as to why the thus would be the case? Thanks!

Edit: I got it.. mistyped the code in timing.py 😅

hamiltonbryan
welcome to shbcf.ru