Skip to content

alexeyraspopov/heapsort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Heapsort

A JavaScript Heapsort implementation with O(nlog n) complexity.

ESM Package

Starting from v0.2.0 this package fully moved to ES Modules and ES2015 code. This means no more build step before publishing to NPM.

Ideally you shouldn't spot any difference, but in case you face any issues, see this useful article.

You can also downgrade to v0.1.2 to use all the same functionality, precompiled to ES5.

Install

npm install heapsort

API

import heapsort from 'heapsort';

heapsort(array[, comparator]);

If you need to save the original array you should pass a copy, because heapsort will mutate it.

Comparator is a function which compares two elements and returns 0, 1 or -1. Read more about comparator

License

MIT License (c) Alexey Raspopov

About

A JavaScript Heapsort Algorithm Implementation

Resources

License

Stars

Watchers

Forks

Packages

No packages published