Merge insertion

from Wikipedia, the free encyclopedia
QS IT
This article was due to content flaws on the quality assurance side of the computer science editorial added. This is done in order to bring the quality of the articles from the subject area of ​​computer science to an acceptable level. Help to eliminate the shortcomings in this article and take part in the discussion !  ( + )

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

Individual evidence

  1. Wikipedia page on sorting methods