# bst-playground

> Playground to try out algorithms around BST

Latest version **0.4.0** (published 2015-05-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install bst-playground
pnpm add bst-playground
yarn add bst-playground
bun add bst-playground
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2015-05-20 |
| First published | 2015-05-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Sushil Baid |
| Maintainers | sushilbaid |
| Keywords | bst |

## Links

- npm: https://www.npmjs.com/package/bst-playground
- Repository: https://github.com/sushilbaid/bst-play-ground
- Issues: https://github.com/sushilbaid/bst-play-ground/issues
- npm.io page: https://npm.io/package/bst-playground

## Dependencies (1)

- [chai](https://npm.io/package/chai.md) 2.3.0

## Recent versions

- 0.4.0 (latest) — 2015-05-20
- 0.3.0 — 2015-05-18
- 0.2.0 — 2015-05-18
- 0.1.0 — 2015-05-16
- 1.0.0 — 2015-05-16

## README

# BST Playground
BST Playground module can be used to try out BST algorithms.

## Installation
```sh
$ npm install bst-playground
```

## Version
0.3.0

## Functions
* createNode(value)
* createTree(inOrder, postOrder)
* class Node
 * depth()
 * find(value)
 * height()
 * isBst()
 * lca(values)
 * visitInOrder()
 * visitPostOrder()

#### createNode(value)
returns a node with the given value. value is number type.

#### createTree(inOrder, postOrder)
creates tree with the given inOrder and postOrder traversals - both arrays.
return the root node of the tree.

### class Node
#### depth()
returns depth of a node.
from wikipedia: The depth of a node is the number of edges from the node to the tree's root node. 

#### find(value)
finds & returns node with value. otherwise, undefined.

#### isBst()
returns true if the subtree at this node is BST. otherwise, false.

#### lca(values)
returns least common ancestor of the given nodes (values). If none, returns undefined.

#### height()
returns height of a node.
from wikipedia: The height of a node is the number of edges on the longest downward path between that node and a leaf 

#### visitInOrder()
visits tree in in order and returns the values in an array.

#### visitPostOrder()
visits tree in post order and returns the values in an array.

License
-------
MIT

---
_Source: https://npm.io/package/bst-playground · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
