Comparing version 0.0.1 to 0.1.0
{ | ||
"name": "plentiful", | ||
"version": "0.0.1", | ||
"description": "A bountyful amount of algorithms to pick from, choose your poison.", | ||
"main": "main.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ajnauleau/plentiful.git" | ||
}, | ||
"keywords": [ | ||
"algorithms", | ||
"computer", | ||
"science", | ||
"sort", | ||
"tim", | ||
"binary", | ||
"merge", | ||
"quick", | ||
"bubble", | ||
"ciphers", | ||
"blowfish", | ||
"twofish", | ||
"threefish", | ||
"helix", | ||
"phelix", | ||
"solitaire", | ||
"skein", | ||
"hash", | ||
"table", | ||
"tree", | ||
"tables", | ||
"trees", | ||
"chains", | ||
"lists", | ||
"data", | ||
"types" | ||
], | ||
"author": "Antoine Nauleau <antoine@nauleau.io> (http://plentiful.nauleau.io)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/ajnauleau/plentiful/issues" | ||
}, | ||
"homepage": "https://github.com/ajnauleau/plentiful#readme", | ||
"dependencies": { | ||
"babel": "^6.23.0" | ||
} | ||
"name": "plentiful", | ||
"version": "0.1.0", | ||
"description": "A bountyful amount of algorithms to pick from, choose your poison.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified | Run but needs fix\" && exit 0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ajnauleau/plentiful.git" | ||
}, | ||
"keywords": [ | ||
"algorithms", | ||
"computer", | ||
"science", | ||
"sort", | ||
"tim", | ||
"binary", | ||
"merge", | ||
"quick", | ||
"bubble", | ||
"ciphers", | ||
"blowfish", | ||
"twofish", | ||
"threefish", | ||
"helix", | ||
"phelix", | ||
"solitaire", | ||
"skein", | ||
"hash", | ||
"table", | ||
"tree", | ||
"tables", | ||
"trees", | ||
"chains", | ||
"lists", | ||
"data", | ||
"types" | ||
], | ||
"author": "Antoine Nauleau <antoine@nauleau.io> (http://plentiful.nauleau.io)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/ajnauleau/plentiful/issues" | ||
}, | ||
"homepage": "https://github.com/ajnauleau/plentiful#readme", | ||
"dependencies": { | ||
"babel": "^6.23.0" | ||
} | ||
} |
@@ -1,21 +0,27 @@ | ||
[![Plentiful Logo](https://s3.amazonaws.com/plentiful/plentiful-thick-moved%405x.png)](http://plentiful.nauleau.io/) | ||
[![Plentiful Logo](https://github.com/ajnauleau/plentiful/blob/develop/assets/5x/Asset%208%405x.png)](http://plentiful.nauleau.io/) | ||
A bountyful amount of algorithms ripe for the picking, choose your poison. runs with [node](http://nodejs.org). | ||
A bountyful amount of algorithms ripe for the picking, choose your poison. runs with [node](http://nodejs.org). | ||
[![NPM Version][npm-image]][npm-url] | ||
[![NPM Downloads][downloads-image]][downloads-url] | ||
[![Linux Build][travis-image]][travis-url] | ||
[![Test Coverage][circleci-image]][circleci-url] | ||
[![npm version](https://badge.fury.io/js/plentiful.svg)](https://badge.fury.io/js/plentiful) | ||
[![npm downloads](https://img.shields.io/badge/downloads-live-brightgreen.svg)](https://www.npmjs.com/package/plentiful) | ||
[![CircleCI](https://circleci.com/gh/ajnauleau/plentiful.svg?style=shield)](https://circleci.com/gh/ajnauleau/plentiful) | ||
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/ajnauleau/plentiful/issues) | ||
```js | ||
import Plentiful from 'plentiful'; | ||
import { Plentiful } from "plentiful"; | ||
Plentiful.sorts.timSort(); | ||
Plentiful() | ||
Plentiful(); | ||
``` | ||
This repository is a collection of many if not all common and popular algorithms implemented and rewritten in JavaScript. The list in constantly expanding-- feel free to contribute! | ||
An algorithm is an unambiguous specification of how to solve a class of problems. It is a set of rules and steps that precisely define a set or sequence of operations. | ||
Each algorithm has its own separate README containing relevant information and explanations and links for further reading. | ||
## Installation | ||
This is a [Node.js](https://nodejs.org/en/) module available through the | ||
This is a [Node.js](https://nodejs.org/en/) package available through the | ||
[npm registry](https://www.npmjs.com/). | ||
@@ -30,3 +36,3 @@ | ||
```bash | ||
$ npm install plentiful | ||
$ npm install -g plentiful | ||
``` | ||
@@ -39,28 +45,34 @@ | ||
* List of most to all algorithms | ||
* Everything implemented in Javascript | ||
* Focus on high performance | ||
* //add info | ||
* //add info | ||
* //add info | ||
* //add info | ||
* //add info | ||
- List of most to all algorithms | ||
- Everything implemented in Javascript | ||
- Focus on high performance | ||
## Docs & Community | ||
* [Website and Documentation](http://plentiful.nauleau.io) - [[website repo](https://github.com/ajnauleau/plentiful/plentiful.nauleau.io)] | ||
* [#plentiful](https://webchat.freenode.net/?channels=plentiful) on freenode IRC | ||
* Visit the [Wiki](https://github.com/ajnauleau/plentiful/wiki) | ||
* [Slack](https://project-plentiful.slack.com) for discussion | ||
- [Website and Documentation](http://plentiful.nauleau.io) - [[website repo](https://github.com/ajnauleau/plentiful/plentiful.nauleau.io)] | ||
- [#plentiful](https://webchat.freenode.net/?channels=plentiful) on freenode IRC | ||
- Visit the [Wiki](https://github.com/ajnauleau/plentiful/wiki) | ||
- [Slack](https://project-plentiful.slack.com) for discussion | ||
### Security Issues | ||
If you discover a security vulnerability in Express, please see [Security Policies and Procedures](Security.md). | ||
If you discover a security vulnerability in Plentiful, please see [Security Policies and Procedures](Security.md). | ||
## Quick Start | ||
The quickest way to get started with Plentiful is to install globally and then use the implementType [`implementType`](https://github.com/ajnauleau/plentiful/implements/implementType) which will apply the best algorithm for the given task: | ||
The quickest way to get started with Plentiful is to install the package to your project and then call and use the algorithm you are looking for your needs: | ||
Install the Plentiful repo: | ||
```js | ||
import { Plentiful } from "plentiful"; | ||
Plentiful.sorts.timSort(); | ||
Plentiful(); | ||
``` | ||
Otherwise, for research or testing purposes you can install Plentiful globally and then use the implementType [`implementType`](https://github.com/ajnauleau/plentiful/implements/implementType) which will apply the best algorithm for the given task: | ||
Install the Plentiful repo: | ||
```bash | ||
@@ -70,12 +82,12 @@ $ npm install -g plentiful | ||
Call any algorithm you can think of: | ||
Call any algorithm you can think of: | ||
```bash | ||
$ plentiful timsort | ||
$ plentiful timsort arrayToBeSorted | ||
``` | ||
Utilize implementType on any data set and find the bext algorithm to use: | ||
Utilize implementType on any data set and find the best algorithm to use: | ||
```bash | ||
$ plentiful implementType | ||
$ plentiful implementType $data | ||
$ timsort(data)? [Y/n] | ||
@@ -85,3 +97,3 @@ $ ... | ||
Install dependencies: | ||
Install dependencies: | ||
@@ -94,9 +106,7 @@ ```bash | ||
Just find the right algorithm and have fun, don't waste your time porting to a C++ library when you can call anything with Plentiful! | ||
Just find the right algorithm and have fun, don't waste your time porting to a C++ library when you can call any common and popular algorithm with Plentiful! | ||
``` | ||
## Tests | ||
To run the test suite, first install the dependencies, then run `npm test`: | ||
To run the test suite, first install the dependencies, then run `npm test`: | ||
@@ -108,12 +118,9 @@ ```bash | ||
## People | ||
## License | ||
The author of Plentiful is [Antoine Nauleau](https://github.com/ajnauleau) | ||
[MIT](LICENSE) | ||
The current lead maintainer is [Antoine Nauleau](https://github.com/ajnauleau) | ||
TODOs | ||
[List of all contributors](https://github.com/ajnauleau/plentiful/contribute/contributors) | ||
## License | ||
[MIT](LICENSE) | ||
- Feature Description | ||
- Example => Porting a new algorithm to javascript source Array.prototype.sort = Plentiful.sort.sorted(). |
@@ -0,25 +1,28 @@ | ||
const binarySearch = (array, num, start, end) => { | ||
if (start == end) { | ||
if (array[start] > num) { | ||
return start; | ||
} else { | ||
return start + 1; | ||
} | ||
if (start === end) { | ||
if (array[start] > num) { | ||
return start; | ||
} else { | ||
return start + 1; | ||
} | ||
} | ||
if (start > end) { | ||
return start; | ||
} | ||
if (start > end) { | ||
return start; | ||
} | ||
let mid = round((start + end) / 2); | ||
let mid = Math.round((start + end) / 2); | ||
if (array[mid] < num) { | ||
return binarySearch(array, num, mid + 1, end); | ||
} else if (array[mid] > num) { | ||
return binarySearch(array, item, start, mid - 1); | ||
} else { | ||
return mid; | ||
} | ||
if (array[mid] < num) { | ||
return binarySearch(array, num, mid + 1, end); | ||
} else if (array[mid] > num) { | ||
return binarySearch(array, num, start, mid - 1); | ||
} else { | ||
return mid; | ||
} | ||
}; | ||
export default binarySearch; | ||
//console.log(binarySearch([1, 3, 7, 5, 6, 9, 1, 3, 4], 1, 8, 9)); |
@@ -1,2 +0,1 @@ | ||
// Tim Sort is an array which analysis |
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
23249
22
90
121