RePublic of CS
  • INFO
    • ❔What is RePublic of CS?
    • πŸ—ΊοΈRCS Open Course
    • πŸ›οΈRCS Classroom
    • πŸ‘©β€πŸŒΎRCS Forum (soon)
    • 🌟RCS Mentors
    • πŸ™‹ε¦‚δ½•εƒθˆ‡ε­ΈηΏ’οΌŸ
      • ⏳RCS.101 x Miters (24 Q2)
  • βš’οΈRCS.101
    • Β§ DSA In Action
    • RCS.101.a
    • RCS.101.b
    • RCS.101.c
    • RCS.101.d
    • ΒΆ Graduation
      • Apx: BFS/Shortest Path
      • Apx: Classic Applications
      • Apx: Techniques & Tricks
      • Apx: Morris Traversal
      • Apx: RCS.101 x Miters W6
      • Apx: In-place Merge Sort
  • πŸ“šRCS.102
    • Β§ Algorithm Design & Analysis
    • βŒ› Divide & Conquer
    • βŒ› Recursion
  • 🧡RCS.103
    • Β§ SYS/PARL Programming
  • πŸ¦€RCS.201
    • Β§ Rust
  • 🧱RCS.301
    • Β§ Software Architecture
  • 🏰RCS.302
    • Β§ Web System Design
  • πŸ“£MEDIA
    • YouTube
    • Twitch
    • Threads
    • Discord Forum
    • Become an Editor
    • Resources
  • πŸ“œArticles
    • System Design, Actually
Powered by GitBook
On this page
  1. RCS.101
  2. ΒΆ Graduation

Apx: In-place Merge Sort

PreviousApx: RCS.101 x Miters W6NextΒ§ Algorithm Design & Analysis

Last updated 1 year ago

Merge Sort, historically in the textbook had been introduced as a subpar sorting algorithm. Although it having a few prestige properties like being and having no degraded performance edge.

It had been known as being less space-efficient, due to the required use of auxiliary array from the merging/conquer process.

Due the allocation nature of merge sort, and the absence of a holy grail sorting algorithm. Quick Sort still had long been seen as the most and only optimal sorting algorithm.

If we think about it, the last missing step of being able to come up with an in-place merge sort. Is for us to find a O(n)O(n)O(n)function that could merge 2 sorted ranged from an array in-place.

For future self, here were all the references I've gathered for this particular topic. (in-place merge sort/efficient in-place merge)


Fast forward in time, as for 2024. There had now been several practical algorithm that can achieve O(N)O(N)O(N),O(1)O(1)O(1) as well as being stable.

Notable References

However, does the story necessary had to end like that ?

Meanwhile, if we were to do some additional time researching, the best thing we have is in C++. Which still only operates in O(Nβˆ—logN)O(N*log N)O(Nβˆ—logN)time.

StackOverflow:

StackOverflow:

StackExchange:

StackOverflow:

StackOverflow:

StackOverflow:

Several new algorithms were now being regarded as the , , and Block Sort itself now being seen as a new generation of space & time efficient sorting algorithms.

GitHub:

GitHub:

YouTube:

Rust:

GitHub:

ACM:

πŸ€”
std::ranges::inplace_merge
Post which claimed to have implemented O(N)O(N)O(N), O(1)O(1)O(1) range merging.
How to sort in-place using the merge sort algorithm
Worst case 𝑂(𝑛 log 𝑛) in place stable sort?
Stable and in-place sorting algorithm?
Regarding in-place merge in an array
Quicksort vs. In-place Merge Sort
Block Merge Sort Family
Wiki Sort
Grail Sort
BonzaiThePenguin/WikiSort
HolyGrailSortProject/Rewritten-Grailsort
The Perfect Sorting Algorithm?? Block Sort Explained (Wiki Sort, Grail Sort)
Unallocating stable sort
Use grailsort for sort_unstable
Practical in-place merging
In-Place Sorting With Merge Sort
βš’οΈ
stable
An in-place, stable, worst O(n log n) sorting algorithm is longly regarded as the holy grail of sorting (reference: Coursera - Algorithms |)
Page cover image