Algorithm 3 Merge Sort Vectors Third Algorithm Merge Sort Algorithm Using Vector Data Stru Q37060607

Algorithm 3: merge sort on vectors

The third algorithm is the merge sort algorithm, using a vectordata structure as input and output. This can be a faithfulimplementation of the vector-based pseudocode in section 7.5 ofADITA. The final draft of that pseudocode is on page 199 of version0.9.10 of ADITA.

Merge sort takes O(n n)time, so we expect this algorithm’sruntime to be proportional to that of the built-in sort. Howevermerge sort is out-of-place, so needs to allocate and free memory,which is a relatively slow O(1)-time operation. It is alsorecursive, and recursion tends to have worse constant factors thanloops. So we expect vector merge

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.