Merge insertion
Merge Insertion is a recursive , comparison- oriented sorting method that uses fewer comparisons than mergesort .
Idea of the algorithm
The actual structure of the algorithm is difficult to understand. Therefore, the idea of Merge Insertion should be briefly explained at this point .
Mergesort always requires the same number of comparisons depending on the input length , regardless of whether it is a power of two or not. This fact makes Merge insertion to Use and therefore it creates to manage with less than Compare Mergesort. The idea is not to split up the input during the recursion into partial lists of equal size, but to always process the next higher power of two. As a result, Merge Insertion only requires a very small number of more comparisons than is theoretically necessary in comparison to the information-theoretical lower bound .
running time
Merge insertion has a complexity in the best, average and worst case .
Algorithm as pseudocode
procedure MergeInsertion ( ):
1. Sortiere die Eingabe mit je einem Vergleich in disjunkte Paare. Ergebnis: mit 2. Sortiere die größeren Elemente rekursiv mit MergeInsertion. 3. Nenne das Ergebnis aus Schritt 2 die Hauptkette: Füge nun die restlichen Elemente durch Binäres Einfügen in der Reihenfolge in die Hauptkette ein.
literature
- Donald E. Knuth : Sorting and Searching / The Art of Computer Programming . Addison-Wesley Longman, 2nd edition, 2003, ISBN 0201896850