The Draftsbook Blog
Articles, deep dives, and notes from the engineering community.
Tree Sort: Mechanism, Complexity Analysis & Interactive Visualizer
An elegant tree-based algorithm: build a Binary Search Tree (BST) from the elements, then retrieve them in sorted order using an in-order traversal.
By Md. Harun-Or-Roshid
American Flag Sort: Mechanism, Complexity Analysis & Interactive Visualizer
An efficient, in-place variant of MSD Radix Sort. It classifies elements into buckets and uses a permutation cycle to swap them into class boundaries in-place.
By Md. Harun-Or-Roshid
Flashsort: Mechanism, Complexity Analysis & Interactive Visualizer
A brilliant, non-comparison sorting algorithm that achieves O(n) average-case speed in-place. It classifies elements into buckets, permutes them, and finishes with a fast Insertion Sort pass.
By Md. Harun-Or-Roshid
Pigeonhole Sort: Mechanism, Complexity Analysis & Interactive Visualizer
A simple, non-comparison sorting algorithm that is ideal when the range of values is approximately equal to the number of elements.
By Md. Harun-Or-Roshid
Bucket Sort: Mechanism, Complexity Analysis & Interactive Visualizer
A distribution-based sorting algorithm that partitions elements into a finite number of buckets, sorts each bucket individually (using Insertion Sort), and then merges them.
By Md. Harun-Or-Roshid
Radix Sort (MSD): Mechanism, Complexity Analysis & Interactive Visualizer
A divide-and-conquer, digit-based sorting algorithm that processes digits from Most Significant (leftmost) to Least Significant, recursively sub-sorting buckets.
By Md. Harun-Or-Roshid
Radix Sort (LSD): Mechanism, Complexity Analysis & Interactive Visualizer
A clever sorting algorithm that processes digits from Least Significant (rightmost) to Most Significant (leftmost) using a stable sorting subroutine like Counting Sort.
By Md. Harun-Or-Roshid
Counting Sort: Mechanism, Complexity Analysis & Interactive Visualizer
An efficient, non-comparison-based sorting algorithm that runs in linear time. It works by counting the occurrences of each key within a specific range.
By Md. Harun-Or-Roshid
Smoothsort: Mechanism, Complexity Analysis & Interactive Visualizer
A brilliant, adaptive variation of Heapsort developed by Edsger Dijkstra in 1981. It achieves O(n) performance on sorted data while maintaining O(n log n) worst-case performance.
By Md. Harun-Or-Roshid
Weak Heap Sort: Mechanism, Complexity Analysis & Interactive Visualizer
A clever sorting algorithm that relaxes the structure of binary heaps to minimize element comparisons, achieving performance extremely close to the information-theoretic lower bound.
By Md. Harun-Or-Roshid
Heap Sort: Mechanism, Complexity Analysis & Interactive Visualizer
An elegant comparison-based sorting algorithm that organizes data into a binary heap to extract elements in sorted order efficiently and in-place.
By Md. Harun-Or-Roshid
Dual-Pivot Quick Sort: Mechanism, Complexity Analysis & Interactive Visualizer
Two pivots, three partitions. Vladimir Yaroslavskiy's 2009 variant became the default sort in Java 7 and runs about 10–20% faster than classical quicksort.
By Md. Harun-Or-Roshid