Let's write an inplace Heapsort in Swift

Using only extensions, learn how to implement a inplace heapsort, and order your lists in O(n log n).

Photo by chuttersnap on Unsplash

I was really interested on this problem of sorting elements. Sorting with heapsort is fast! But it has a big problem: conventionally you have to build a heap to use a heap sort. In a real world usually you don't have a heap…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store