๐ข Codes containing implementation of data structures in Typescript.
This application requires the following resources:
- ๐ฒ Node.js (https://nodejs.org/en/)
- ๐ Code Editor (https://code.visualstudio.com/)
Optional:
- ๐งถ ๐ Yarn (https://yarnpkg.com/)
After having the project cloned on your computer and opening the folder, you must install the dependencies.
With yarn: run the following command in your project clone
yarn
With npm:
npm install
The classes of the algorithms have already been instantiated in the file src/main.ts. You can change this implementation if you want.
import Stack from './algorithms/stack';
import Queue from './algorithms/queue';
import Deck from './algorithms/deck';
import binarySearch from './algorithms/binarySearch';
const InstantiatedStack = new Stack();
const InstantiatedQueue = new Queue();
const InstantiatedDeck = new Deck();
InstantiatedStack.push(5, 6, 7, 8, 9);
console.log(InstantiatedStack.showStack()); // [5, 6, 7, 8, 9]
InstantiatedStack.pop(); // 9
console.log(InstantiatedStack.showStack()); // [5, 6, 7, 8]
InstantiatedQueue.enqueue(12);
InstantiatedQueue.enqueue(55);
InstantiatedQueue.enqueue(9);
console.log(InstantiatedQueue.showQueue()); // [12, 55, 9]
InstantiatedQueue.dequeue(); // 12
console.log(InstantiatedQueue.showQueue()); // [55, 9]
InstantiatedDeck.addBack(6);
InstantiatedDeck.addFront(3);
console.log(InstantiatedDeck.showDeck()); // [3, 6]
console.log(binarySearch([67, 69, 70, 85, 100, 102, 254, 800], 70)); // 70
With yarn:
yarn start
Wiht npm:
npm run start
Leonardo Oliveira โ @leozartino โ leozartino@gmail.com
Distributed under the MIT license. See MIT for more information.
Feel free to contribute by adding other data structure algorithms using typescript. Add the files in the folder src/algorithms.
- Fork it (https://github.com/Leozartino/data-structures-ts/fork)
- Create your feature branch (
git checkout -b feature/newFeature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin feature/newFeature
) - Create a new Pull Request
- Leonardo de Andrade Oliveira (leozartino) - Javascript Developer Made with ๐