Skip to content

swiftxru/data-structs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data structures

ts Size Version Downloads

📃 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

import {Stack} from './stack';

const stack = new Stack<string>(4);
stack.push('one');
stack.push('two');
stack.push('three');
stack.push('four');
stack.push('five'); // Throws error, capacity is 4

stack.size(); // Output: 4
stack.peek(); // Output: "four"
stack.size(); // Output: 4
stack.pop();  // Output: "four"
stack.size(); // Output: 3

Authors/maintainers

License

This project is licensed under the MIT License - see the LICENSE file for details