Posts tagged "sorting algorithm"


Mergesort is an important sorting algorithm when you don鈥檛 have efficient random memory access, since it doesn鈥檛 rely on that and has good time complexity - O(n logn) specifically.

As a typical divide-and-conquer algorithm, Mergesort has two steps: first it recursively splits the lists in two until each half is unitary, then it recursively mends back the lists until it reaches the original size.

But before we dive into the actual algorithm, we need to make some changes to the linked list algorithm we鈥檒l be using.