r/programming • • Dec 02 '19

Bubble sort visualization

7.4k Upvotes

268 comments sorted by

View all comments

Show parent comments

-7

u/[deleted] Dec 02 '19

Lol, bruh why so serious?

Why would you teach anyone how not to do something? You know there is many ways to inefficiently sort a list. Why make a video about any of them?

If you're going to teach bubblesort, you might as well teach Bogosort.. maybe eventually after seeing all the ways you're not supposed to sort a list, the student will arrive at a better algorithm on their own. But this seems inefficient. IMO, the introductory algorithm to sorting is Selection sort. It's intuitive and while not terribly efficient, it does allow you to build on the knowledge and introduce more complex algorithms, bubblesort does not.

Bubblesort, is just some stupid peace of trivia that people who are full of themselves like to bring up as a stupidly overused joke.

2

u/BruhWhySoSerious Dec 02 '19

You know there is many ways to inefficiently sort a list.

That's a terrible assumption. Not everyone is as gifted as you.

We can't keep people out of a passing lane or use blinkers and you think people are naturally, and casually looking for better ways to improve their sorting efficiency?

2

u/[deleted] Dec 02 '19

What? All I am saying, is if you were to teach someone sorting algorithms, do not teach them something useless that has no potential to build up to anything useful.

What you are arguing is that the best way to teach a kid how to tie their shoes is by first showing them how to make a dead knot. Sure it's simple, but what is it's use, not like you can go on and teach other knots from there. You're basically teaching someone how to fuck up.

1

u/chucker23n Dec 03 '19

Why would you teach anyone how not to do something?

Umm. To explain strengths and weaknesses? To explain how to optimize something that already fulfills requirements but isn’t efficient? To make a design trade off that the simpler algorithm is sometimes good enough?

IMO, the introductory algorithm to sorting is Selection sort.

Selection sort introduces state and is therefore way more complicated to explain.

1

u/[deleted] Dec 03 '19

How does selection sort introduce state?

And why do you think it's more complicated to explain? It is literally how a fourth grader would approach sorting a list of numbers, it is how you would sort the money in your wallet, it is the default human way of thinking.