https://github.com/swiftxru/data-structs
Data structures implementations
https://github.com/swiftxru/data-structs
nodejs queue stack typescript
Last synced: 3 months ago
JSON representation
Data structures implementations
- Host: GitHub
- URL: https://github.com/swiftxru/data-structs
- Owner: swiftxru
- License: mit
- Created: 2022-09-30T12:32:27.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-09-30T15:25:10.000Z (almost 3 years ago)
- Last Synced: 2024-02-23T03:44:31.724Z (over 1 year ago)
- Topics: nodejs, queue, stack, typescript
- Language: TypeScript
- Homepage:
- Size: 43.9 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Data structures



## 📃 Description
Data structures implementations:
- Stack
- Queue## 📦 Getting Started
These instructions will get you setup to use `data-structs` in your project.
| | using NPM | using Yarn |
|-----------------:|--------------------------------------------|-----------------------------------------------|
| **Installation** | `npm i -D @swiftx/data-structs typescript` | `yarn add -D @swiftx/data-structs typescript` |## Usage
```typescript
import {Stack} from './stack';const stack = new Stack(4);
stack.push('one');
stack.push('two');
stack.push('three');
stack.push('four');
stack.push('five'); // Throws error, capacity is 4stack.size(); // Output: 4
stack.peek(); // Output: "four"
stack.size(); // Output: 4
stack.pop(); // Output: "four"
stack.size(); // Output: 3
```## Authors/maintainers
- **Klyuchevskiy Valeriy** - [vklyuche](https://github.com/vklyuche)
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details