An open API service indexing awesome lists of open source software.

https://github.com/aryan02420/sorts

different sorting algorithms implemented using generator functions
https://github.com/aryan02420/sorts

generator-function sorting-algorithms

Last synced: 3 months ago
JSON representation

different sorting algorithms implemented using generator functions

Awesome Lists containing this project

README

          

# Sorts
[![tests][tests-shield]][tests-url]
[![npm][npm-shield]][npm-url]

different sorting algorithms implemented using generator functions

- Bubble
- Cocktail
- Comb
- Insertion
- Quick
- Selection

### Installation

```js
npm i @aryan02420/sorts
```

### Usage

```js
const {Bubble} = require('@aryan02420/sorts')
let array = [2,5,3,7,1]
let bSort = Bubble(array)

console.log(bsort.next().value.array) // [ 2, 3, 5, 7, 1 ]
console.log(bsort.next().value.array) // [ 2, 3, 5, 1, 7 ]
```

```js
const sortingAlgos = require('@aryan02420/sorts')
let sSort = sortingAlgos.Selection(array)
sSort.next()
```

```js
const {Insertion: isort} = require('@aryan02420/sorts')
let iSort = isort(array)
iSort.next()
```

```js
// browser
qsort = sorts.Quick(array)
qsort.next()
```

### Demo Project

[aryan02420/sort-visualiser][demo-url]

[tests-shield]: https://img.shields.io/github/workflow/status/aryan02420/Sorts/tests?label=tests
[tests-url]: https://github.com/aryan02420/sorts/actions/workflows/test-runner.yml
[npm-shield]: https://img.shields.io/npm/v/@aryan02420/sorts
[npm-url]: https://www.npmjs.com/package/@aryan02420/sorts
[demo-url]: https://github.com/aryan02420/sort-visualiser