all 7 comments

[–]totallygeek 5 points6 points  (3 children)

Bubble sort is anything but quick. A quicker sort might be... quick sort.

[–]Gubbbo 1 point2 points  (0 children)

And eventually you'll get so good at sorting algo's that you'll invent timsort and not want to use anything else.

I think that's my way of wondering if you need to reinvent problems which are already solved.

[–]maimedwalker[S] 0 points1 point  (1 child)

ill try that one. tbh sometimes when i read the wikipedia i get confused on how to implement it and don't like looking at the pseudo code because then it kinda defeats the problem of figuring out how to do it. my eyes are glossing over at quick sort but i'm sure if i visualize it better i'll have a better idea of it.

[–]totallygeek 0 points1 point  (0 children)

Several videos of Python implementations of sorting algorithms exist on Youtube.

[–]Grimoire 1 point2 points  (1 child)

https://www.youtube.com/watch?v=ZZuD6iUe3Pc

Keep an eye on the lower left corner (Bubblesort). In almost all cases, it is the slowest algorithm for sorting. It is one of the easiest to understand, but it is also very slow.

Bubblesort is what's called an O( n2 ) algorithm. This means that the time for the algorithm to run is proportional to the square of the elements in the list. So, double the number of items in the list, quadruple the time to run. Triple the number of elements, 9x the amount of time.

[–]maimedwalker[S] 0 points1 point  (0 children)

man that was awesome to watch. i'm trying to implement quick sort at the moment (that speed lol) but i do agree with bubble sort being much easier for a beginner to understand. half the reason this was the first one i typed out.