Skip to content

Examplio/ts-sort-algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Optimized Sort Algorithm

This project contains a highly optimized implementation of merge sorting written in TypeScript.

  • Worst case => O(n log n)

  • Good case => O(n)

Features

  • Recursion-based divide & conquer strategy
  • Multiple optimizations:
  • Early exit when left max ≤ right min
  • Small-overlap optimized merge
  • Preallocated merge buffer
  • No spread operators, no splice slow-path

Installation

npm install

Statistic

N - random values array length (horizontal)

My Chart