Skip to content
/ btree-js Public
forked from yangez/btree-js

Allen Chang and Eric Yang's javascript b-tree implementation

License

Notifications You must be signed in to change notification settings

s1pz/btree-js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

btree-js

Demo: JS BTree

This is Allen Chang and Eric Yang's javascript implementation for B-tree of order 3 and above.

Currently we can search and insert. We derived our own insert algorithm as follows:

  1. Traverse the b-tree for the correct leaf to insert the value.
  2. Insert value into leaf.
  • If the node has space, simply insert the value and we're done.
  • If node overflows and it's root, split the node and create a new parent with the median.
  • If node overflows and has a parent, split the node and insert the median into the parent. Go up to parent and repeat step 2 until it doesn't overflow.
  1. Go back all the way down and connect all the split nodes to the appropriate parents.

It turns out that there's a more efficient algorithm where you don't have to go up and back down, but ours still works fine.

About

Allen Chang and Eric Yang's javascript b-tree implementation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 74.2%
  • HTML 20.6%
  • SCSS 5.2%