1.0.3 • Published 4 years ago

@sivarajans/heap-sort-desc v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Heap Sort

Max Heap Invarient data structure is used to sort.

  1. Do max heap invarient structure.
  2. Swap last element with root
  3. Pop last element (which is root) that has maximum value.

Zero Based Index Formula:

All the parent = floor(n / 2) - 1 -- here n is total elements.

Child-1 of parent = 2i + 1 -- here i is index (0 based)
Child-2 of parent = 2i + 2

npm i @sivarajans/heap-sort-desc

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago