понедельник, 18 октября 2021 г.

Merge sort with O(sqrt(n)) auxiliary memory complexity (and even less)

In this text an algorithm is described that merges two sorted arrays into one sorted array. Time complexity is O(n), auxiliary memory complexity is O(sqrt(n)), and stable. If this algorithm is used for merge sort, then resulting sorting algorithm will be stable, have O(nlog(n)) time complexity and have O(sqrt(n)) auxiliary memory (and even less for some cases).