Socket
Book a DemoInstallSign in
Socket

@dustinleethomas/structs

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dustinleethomas/structs

playing around with NPM and creating a simple data structure library

latest
Source
npmnpm
Version
2.4.2
Version published
Maintainers
1
Created
Source

@dthomas314/structs

structs library for npm package

(https://github.com/dthomas314/structs)

Install

$ npm install @dustinleethomas/structs

Usage

const MinHeap = require("@dustinleethomas/structs/MinHeap");

let testArray = [1, 4, 2, 7];
let myHeap = new MinHeap();

for(const elem of testArray) {
    myHeap.insert(elem);
}

myHeap.print();
console.log(myHeap.remove());
myHeap.print();
console.log(myHeap.remove());
myHeap.print();
console.log(myHeap.remove());
myHeap.print();
console.log(myHeap.remove());
myHeap.print();
console.log(myHeap.remove());
myHeap.print();
const Graph = require("@dustinleethomas/structs/Graph");

let myGraph = new Graph(6);

myGraph.addVertex('A');
myGraph.addVertex('B');
myGraph.addVertex('C');
myGraph.addVertex('D');
myGraph.addVertex('E');
myGraph.addVertex('F');

myGraph.addEdge('A', 'B');
myGraph.addEdge('A', 'D');
myGraph.addEdge('A', 'E');
myGraph.addEdge('B', 'C');
myGraph.addEdge('D', 'E');
myGraph.addEdge('E', 'F');
myGraph.addEdge('E', 'C');
myGraph.addEdge('C', 'F');

myGraph.print();

console.log('BFS');
myGraph.bfs('A');

console.log('DFS');
myGraph.dfs('A');

Keywords

heap

FAQs

Package last updated on 07 Mar 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.