TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Yet another explanation of the Quicksort algorithm

18 pointsby dennis714over 5 years ago

2 comments

BubRossover 5 years ago
This is not at all a good explanation of quicksort and in some cases like finding the arithmetic mean, it isn&#x27;t even right.<p>Here is a simple explanation:<p>First, understand the partition algorithm. You have an unsorted array, pick a value, then put everything less or equal on one side and everything greater on the other side of the array. The partition function returns the crossover point in the array that separates the two sides once it is done.<p>Quicksort is just a recursive partition. You partition an array, then partition one side after that, until you just end up with two elements and you don&#x27;t need to recursively sort any further.
kadobanover 5 years ago
Yeah there&#x27;s a lot not great in this.<p>Mean instead of median is a big one. I&#x27;d object more to the basic lack of explanation in many parts though, including why you&#x27;d pick the mean (during which they could well have talked themselves into fixing that error), why randomized is a decent strategy, what you&#x27;re trying to avoid in a pivot, etc.