News for hackers. Stuff that matters.
Re:Why is quicksort better than other sorting algorithms in ... by jrimbault on Monday January 20, 2020 @11:45AM (#22100043)
Weirdly, merge sort might the only sorting algorithm that I learned in school I can actually write without thinking. It's very intuitive and simple, at least to me ?
Re:Why is quicksort better than other sorting algorithms in ... by GuB-42 on Monday January 20, 2020 @01:57PM (#22101213)
Mergesort is used routinely by people who know nothing about programming. For example, it is used by teachers to sort exam papers by grade.

It is one of the rare algorithms that is equally good when run by a computer and by hand.

Re:Why is quicksort better than other sorting algorithms in ... by lenkite on Monday January 20, 2020 @01:53PM (#22101182)
You are not the only one. Merge sort and insertion sort are deeply intuitive sorts. Quicksort is not.
Re:Why is quicksort better than other sorting algorithms in ... by klyrs on Monday January 20, 2020 @01:37PM (#22101048)
Weird flex: I can implement bogosort in my sleep...
Re:Why is quicksort better than other sorting algorithms in ... by xvector on Monday January 20, 2020 @01:52PM (#22101172)
I implement cosmic-ray-bit-flip-bogo-sort in every program I write!
Re:Why is quicksort better than other sorting algorithms in ... by Rebelgecko on Monday January 20, 2020 @05:14PM (#22102519)
it would be more impressive if you could implement Sleepsort in your sleep

For those aren't familiar with sleepsort, it looks something like this, where you use whatever concurrency is available in your programming language of choice to execute the for-loop in parallel

    for n in array:
        sleep(n)
        print(n)
Re:Why is quicksort better than other sorting algorithms in ... by skzo on Monday January 20, 2020 @12:34PM (#22100467)
Insertion sort is very intuitive and simple as well
Re:Why is quicksort better than other sorting algorithms in ... by wolco on Monday January 20, 2020 @01:16PM (#22100837)
The bubble sort just writes itself.
Re:Why is quicksort better than other sorting algorithms in ... by jrimbault on Monday January 20, 2020 @01:46PM (#22101124)
Definitely yes, but I can't write it without thinking like merge sort ¯\_(ツ)_/¯
Re:Why is quicksort better than other sorting algorithms in ... by elfexec on Monday January 20, 2020 @06:23PM (#22102898)
Mergesort is more intuitive than selection sort, insertion sort, bubble sort, etc? I highly doubt you can write merge sort without thinking about it. And I highly doubt you can write bug free merge sort without thinking about it. Merge sort and quick sort are notorious for bugs introduced by trying to keep track of the indexes.

> It's very intuitive and simple, at least to me ?

Once you understand mergesort, you have a eureka moment and it all makes sense. But I've never met anyone who thought merge sort was intuitive and simple - especially when learning it the first time.

Re:Why is quicksort better than other sorting algorithms in ... by jrimbault on Tuesday January 21, 2020 @06:22AM (#22105943)
Didn't say I could it do bug free (c-fashion like), but _correctly_ on paper in an algo exam in pseudo ? Yes.

Also, for future readers, this wasn't a flex, it was intended as an observation of weird things about brains, I learned many sorting algo (like many readers here) and only merge sort kinda stuck.