1.0.1 • Published 4 years ago
data-structure-factory v1.0.1
Data structure factory
Node.js module that provides factory functions regarding common data structures.
const DataStructureFactory = require("data-structure-factory");
const stack = DataStructureFactory.createStack();
stack.push(5);
stack.push(10);
stack.push(15);
stack.print();
let sum = 0;
while (!stack.isEmpty()) {
sum += stack.pop();
}
console.log("The sum of the stack is " + sum);