# ape-algorithm

> Algorithm for APE API

Latest version **0.0.8** (published 2014-08-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install ape-algorithm
pnpm add ape-algorithm
yarn add ape-algorithm
bun add ape-algorithm
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2014-08-13 |
| First published | 2014-06-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=v0.10.5 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | Conan Zhang |
| Maintainers | bsspirit |
| Keywords | quicksort, bucketsort, sort, ape, algorithm |

## Links

- npm: https://www.npmjs.com/package/ape-algorithm
- Repository: https://github.com/bsspirit/ape-algorithm
- Issues: https://github.com/bsspirit/ape-algorithm/issues
- npm.io page: https://npm.io/package/ape-algorithm

## Dependencies (1)

- [linklist](https://npm.io/package/linklist.md) 0.0.3

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 0.0.8 (latest) — 2014-08-13
- 0.0.7 — 2014-08-13
- 0.0.6 — 2014-08-08
- 0.0.5 — 2014-06-17
- 0.0.3 — 2014-06-17
- 0.0.2 — 2014-06-09
- 0.0.1 — 2014-06-09

## README

APE: 算法工具包
========================

支持普通数组的排序和数组对象的排序。

http://blog.fens.me/algorithm-quicksort-nodejs/

## INSTALL

```{bash}
npm install ape-algorithm
```

## API

+ quicksort.js      快速排序
+ insertionsort.js  插入排序
+ bucketsort.js     桶排序
+ data.js           产生随机数据
+ rowcol.js         对JSON数据的行列转换


## Demo

example.js

普通数组快速排序
```{bash}
var arr = [23,12,11,43,54,43,2,12,66];
console.log(arr);
console.log(algo.quicksort.sort(arr));
console.log(algo.quicksort.sort(arr,'desc'));

//output
[ 23, 12, 11, 43, 54, 43, 2, 12, 66 ]
[ 2, 11, 12, 12, 23, 43, 43, 54, 66 ]
[ 66, 54, 43, 43, 23, 12, 12, 11, 2 ]
```
对象数组快速排序，按id值大小排序
```{bash}
var arrObj = [{name:'b',id:12},{name:'c',id:21},{name:'a',id:2}];
console.log(arrObj);
console.log(algo.quicksort.sortObj(arrObj,'id','asc'));
console.log(algo.quicksort.sortObj(arrObj,'id','desc'));

//output
[ { name: 'b', id: 12 },{ name: 'c', id: 21 },{ name: 'a', id: 2 } ]
[ { name: 'a', id: 2 },{ name: 'b', id: 12 },{ name: 'c', id: 21 } ]
[ { name: 'c', id: 21 },{ name: 'b', id: 12 },{ name: 'a', id: 2 } ]
```


## License

MIT

---
_Source: https://npm.io/package/ape-algorithm · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
