Skip to content
/ favl Public

A purely functional AVL tree implementation in JavaScript.

License

Notifications You must be signed in to change notification settings

oelin/favl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

favl

A purely functional AVL tree implementation in JavaScript. This library provides a suitable concrete data structure for implementing the Set abstract data type.

API

const favl = require('favl')


// Tree creation...

let tree = favl.leaf(5)


// Balanced insertion...

tree = favl.insert(favl.leaf(6), tree)
tree = favl.insert(favl.leaf(10), tree)
tree = favl.insert(favl.leaf(4), tree)


// Balanced removal... 

tree = favl.remove(favl.leaf(4), tree)

Note that every operation returns a new tree/node instance since state is immutable.

Releases

No releases published

Packages

No packages published