How To Grailsort: The Definitive Guide

How To Grailsort: The Definitive Guide is a place to understand the Block Merge Sort Grailsort!

= Chapter 1: Improving Merge Sort = This is Merge Sort. >

It is a useful sort, being $$O(n \log n)$$ worst case time and stable. But, it has $$O(n)$$ space complexity.

Remember this figure, our main focus will be reducing it to $$O(1)$$, while retaining Merge Sort's other properties. now, how do we go about doing this?

Why does Merge Sort use $$O(n)$$ memory?

It uses the space for an auxiliary array for merging. this space is a fundamental part of merging, as it efficiently allows us to pick one element from two elements and put it in one place in $$O(1)$$, no matter the element.

We cannot get rid of this space without sacrificing efficiency, as it is a fundamental part of an $$O(n)$$ merge. However, we do not have to use auxiliary space for this. Instead, we can use the space inside of the array. First, we will discuss some truly $$O(1)$$ space merges that sacrifice efficiency, but are required when we cannot use the array's space without destroying stability.

= Chapter 2: The Lazy merge =