Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@rioam2/bstjs
Advanced tools
Basic Dictionary ADT implementation using a Binary-Search-Tree (BST) in Javascript
BSTjs is an npm package for Node.JS that implements the Dictionary ADT using a Binary Search Tree (BST) data structure. The codebase is written in TypeScript with ES6 features which is transpiled to ES5 for compatibility.
For more information on implementation, please read my development article on Medium here: Implementation Details
findNode
for before/after recursion processes (used for balancing calls).[]
).for ... of
loops.Contributions to this project are more than welcome! If you can help with any of the above todo items, here is a timeline for submitting your work that will ensure peace-of-mind for everyone:
./tests/test.js
file. Once all tests are passing, squash all of your commits and send a pull request. Please do not merge with the master branch yet.If you feel that I have made any oversights in the contributing checklist above, please let me know by opening an issue.
The BST class contains all necessary ADT functionality as specified here
insert(key: any
, value: any
) : void
Inserts a new key/value pair into the Binary Search Tree
get(key: any
) : any
Gets the data associated with the supplied key. Returns null if no such key is present in the Binary Search Tree.
remove(key: any
) : void
Removes data with the supplied key from the Binary Search Tree
isEmpty() : bool
Returns true of no data is in the Binary Search Tree and false if the structure stores any data
levelOrderTraversal() : any[]
Returns an array of values in a level-order traversal of the binary-search-tree.
preOrderTraversal() : any[]
Returns an array of values in a pre-order traversal of the Binary Search Tree
inOrderTraversal() : any[]
Returns an array of values in a post-order traversal of the Binary Search Tree. This traversal will return a sorted array of values based on key by definition.
postOrderTraversal() : any[]
Returns an array of values in a post-order traversal of the Binary Search Tree.
FAQs
Basic Dictionary ADT implementation using a Binary-Search-Tree (BST) in Javascript
The npm package @rioam2/bstjs receives a total of 1 weekly downloads. As such, @rioam2/bstjs popularity was classified as not popular.
We found that @rioam2/bstjs 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.