Skip to content

Commit 75a072e

Browse files
authored
Merge pull request #2 from shadowcodex/dev
Dev
2 parents f7147e7 + e0c17e5 commit 75a072e

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

benchmark/stacks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ ptime.setTime('parraystack100000');
3131
for(let i = 0; i < 100000; i++) {
3232
stack.pop()
3333
}
34-
console.log("Pop Array 100,000 Stack timing:", ptime.elapsedTime('parraystack100000').formatted);
34+
console.log("Pop 100,000 Array Stack timing:", ptime.elapsedTime('parraystack100000').formatted);

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"private": false,
1010
"scripts": {
1111
"test": "npx mocha",
12+
"bench:all": "node benchmark/stacks.js && node benchmark/queues.js",
1213
"bench:stacks": "node benchmark/stacks.js",
1314
"bench:queues": "node benchmark/queues.js"
1415
},

readme.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,30 @@ I want to walk the walk before I talk the talk. Using this repository.
1818

1919
As theories and structures are built, I'll list them under this heading.
2020

21-
> You won't see a todo list or a target list this time around. I'll take suggestions as issues on the repository, but I'm going to focus on building commong structures and items one at a time. One thing I have learned as a developer is never get ahead of yourself, you can get paralyzed with planning and expectations.
21+
> You won't see a todo list or a target list this time around. I'll take suggestions as issues on the repository, but I'm going to focus on building commong structures and items one at a time. One thing I have learned as a developer is never get ahead of yourself, you can get paralyzed with planning and expectations.
22+
23+
- `Stack`: based on a linked list (slow)
24+
- `ArrayStack`: based on JS array (fast)
25+
- `Queue`: based on a linked list (fast)
26+
- `ArrayQueue`: based on JS array (slow)
27+
28+
## Use in your projects
29+
30+
```
31+
npm install data-theory
32+
```
33+
34+
```
35+
yarn add data-theory
36+
```
37+
38+
## Usage
39+
40+
```javascript
41+
const { queues } = require('data-theory');
42+
43+
let queue = new queues.Queue();
44+
45+
queue.enqueue('item'); // 1
46+
queue.dequeue(); // 'item'
47+
```

0 commit comments

Comments
 (0)