![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
data-structures-playground
Advanced tools
Implementation of the most common data structures in Javascript
Implementation of the most common data structures in Javascript (ES6+), including linear and non-linear ones, such as Array
, Linked List
, Queue
, Stack
and Binary Tree
.
Futhermore, you will find here implementation of some interesting algorithms like Quick Sort
for sorting arrays and Breadth First Search
or Depth First Search (inOrder, preOrder, postOrder)
for binary trees.
npm i data-structures-playground
After clone this repository you will need to run npm i
to install all dependencies.
import {
Array,
LinkedList,
Queue,
Stack,
} from 'data-structures-playground/src/modules/linear-data-structures/linear-data-structures.module.js';
import { BinaryTree } from 'data-structures-playground/src/modules/non-linear-data-structures/non-linear-data-structures.module.js';
data structures
(examples).const array = new Array();
array.push(10);
array.push(6);
array.push(2);
array.sort();
console.log(array.toString());
const linkedList = new LinkedList();
linkedList.prepend(444);
linkedList.append(3);
linkedList.insert(1, 22);
linkedList.delete(0);
console.log(linkedList.get());
const queue = new Queue();
queue.enqueue(1);
queue.enqueue(2);
queue.enqueue(3);
queue.enqueue(4);
queue.enqueue(5);
queue.dequeue();
queue.dequeue();
let currentQueueItem = queue.peek();
while (currentQueueItem) {
console.log(currentQueueItem.value);
currentQueueItem = currentQueueItem.next;
}
const stack = new Stack();
stack.push(1);
stack.push(2);
stack.push(3);
stack.push(4);
stack.push(5);
stack.pop();
stack.pop();
let currentStackItem = stack.peek();
while (currentStackItem) {
console.log(currentStackItem.value);
currentStackItem = currentStackItem.next;
}
const binaryTree = new BinaryTree();
binaryTree.insert(5);
binaryTree.insert(9);
binaryTree.insert(6);
binaryTree.insert(2);
binaryTree.insert(4);
binaryTree.insert(3);
binaryTree.insert(8);
console.log(binaryTree.breadthFirstSearch());
To run this application you will need only run npm run serve
.
An initial data structure will be generated when the application starts off. Then you can manipulate this data structure inserting information in the inputs and choosing an action by the buttons.
ARRAY
Quick sort
algorithm.string
format.n
value greater than zero in the quantity to delete
argument, it will delete the n
elements after the provided index and replace the value instead of them.LINKED LIST
head
.tail
.QUEUE
STACK
BINARY TREE
Breadth First Search
algorithm.Depth First Search
algorithm using the approach provided by the type argument (it can be inOrder
, preOrder
or postOrder
).Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
FAQs
Implementation of the most common data structures in Javascript
The npm package data-structures-playground receives a total of 1 weekly downloads. As such, data-structures-playground popularity was classified as not popular.
We found that data-structures-playground demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.