Sorting

LinkedHashMap Sorting

Sorting a single-element collection (e.g., arrays or lists) is quite easy in Java. It uses advanced techniques like CountingSort and DualPivotQuickSort. However, it is sometimes necessary to sort multi-element collects such as LinkedHashMaps. Prior to streams in Java 1.8, there was no relatively simply means of sorting these types of collections. I say “relatively simple” […]

LinkedHashMap Sorting Read More »

Counting sort

Counting sort in an \(O\left(n+m\right)\) sorting algorithm (instead of the usual \(O\left(n\log n\right)\)) for integer values, where \(n\) is the number of elements to sort and \(m\) is the width of the data type (e.g., \(2^{8}\) for byte). Its premise is quite simple. Given enough memory, it creates an array the width of the data

Counting sort Read More »