npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

binary-search-tree-by-eli

v1.0.2

Published

## What are they?

Downloads

11

Readme

Binary Search Trees

What are they?

According to GeeksforGeeks:

A Binary Search Tree (BST) is a data structure used in computer science for organizing and storing data in a sorted manner. Each node in a BST has at most two children, a left child and a right child, with the left child containing values less than the parent node and the right child containing values greater than the parent node. This hierarchical structure allows for efficient searching, insertion, and deletion operations on the data stored in the tree.

A simple BST is shown below:

basic-bst-img

Advantages of using a BST

  • When balanced, a BST is very efficient in insertion and deletion. The time complexity is O(log n).
  • The items are always kept in a sorted sequence since BST can automatically sort them as they are entered.
  • BSTs store only the key values, making them space-efficient

Disadvantages of using a BST

  • The key drawback is that a balanced binary search tree needs to be implemented at all times. Otherwise, it's possible that the cost of operations won't be logarithmic (Olog n) and will instead result in a linear array search (On).
  • BSTs require additional memory to store pointers to child nodes.
  • Since the time complexity for search, insert, and delete operations is O(log n), which is good for big data sets but slower than some other data structures like arrays or hash tables, they are not well-suited for data structures that need to be accessed randomly.

To test out my JavaScript implementation of BST

  1. Fork/clone repo and run in your favorite editor (mine is VS Code).
  2. Run npm install to install all the necessary dependencies.
  3. Run nodemon ./src/driverScript.js to run the script using NodeJS.
  4. Un-comment the lines of code and have fun!

References

  1. GeeksforGeeks
  2. Javatpoint
  3. The Odin Project