Tag Archives: sorting
Heap sort in Python.
Here is an example of heapsort in Python. This sorting method happens to be my favorite of the bunch – I like to think that this is the most elegant sorting method, but I’m sure you could argue against me. Edit: I renamed percolateDown to percolateUp because I realized its really more of a “move [...]
Insertion sort in Python.
I’m losing faith in my programming skills today, so I’ve decided to re-implement sorting functions. Each day I’ll try to decrease the complexity of the algorithms, but, this day being the first, I’ll give you a quadratic insertion sort. This is an insertion sort, right, or is it shell sort? Heh… def insertionSort(arr): for i [...]
Sorting methods in Java.