<Li> Several attempts have been made at producing an in - place merge algorithm that can be combined with a standard (top - down or bottom - up) merge sort to produce an in - place merge sort . In this case, the notion of "in - place" can be relaxed to mean "taking logarithmic stack space", because standard merge sort requires that amount of space for its own stack usage . It was shown by Geffert et al. that in - place, stable merging is possible in O (n log n) time using a constant amount of scratch space, but their algorithm is complicated and has high constant factors: merging arrays of length n and m can take 5n + 12m + o (m) moves . This high constant factor and complicated in - place algorithm was made simpler and easier to understand . Bing - Chao Huang and Michael A. Langston presented a straightforward linear time algorithm practical in - place merge to merge a sorted list using fixed amount of additional space . They both have used the work of Kronrod and others . It merges in linear time and constant extra space . The algorithm takes little more average time than standard merge sort algorithms, free to exploit O (n) temporary extra memory cells, by less than a factor of two . Though the algorithm is much faster in practical way but it is unstable also for some list . But using similar concept they have been able to solve this problem . Other in - place algorithms include SymMerge, which takes O ((n + m) log (n + m)) time in total and is stable . Plugging such an algorithm into merge sort increases its complexity to the non-linearithmic, but still quasilinear, O (n (log n)). </Li> <Li> A modern stable linear and implace merging is block merge sort </Li> <P> An alternative to reduce the copying into multiple lists is to associate a new field of information with each key (the elements in m are called keys). This field will be used to link the keys and any associated information together in a sorted list (a key and its related information is called a record). Then the merging of the sorted lists proceeds by changing the link values; no records need to be moved at all . A field which contains only a link will generally be smaller than an entire record so less space will also be used . This is a standard sorting technique, not restricted to merge sort . </P> <P> An external merge sort is practical to run using disk or tape drives when the data to be sorted is too large to fit into memory . External sorting explains how merge sort is implemented with disk drives . A typical tape drive sort uses four tape drives . All I / O is sequential (except for rewinds at the end of each pass). A minimal implementation can get by with just 2 record buffers and a few program variables . </P>

How does merge sort perform when there are duplicate values in the array