You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-5Lines changed: 25 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,9 @@ Data Structures in Javascript
9
9
# Background
10
10
There are neither a lot of resources on internet nor any book which guides and dictates best practices in the implementation of popular Data Structures using Javascript. The purpose of this library is to provide cooked implementation of populare data structures in javascript.
bst.lookup(10) // returns an object with keys hasVal, currentNode and parentNode
77
85
```
78
86
79
87
Height of the binary search tree or a node
88
+
80
89
```js
81
90
bst.height() //gives height of the BST 1
82
91
bst.height(bst.lookup(10).currentNode) // gives the height of the node - 0
83
92
```
84
93
85
94
Traverse the BST and return a List
95
+
86
96
```js
87
97
bst.traverse('inOrder') // traverse method expects a parameter - inOrder|preOrder|postOrder| levelOrder
88
98
```
99
+
89
100
Delete elements from binary search tree
101
+
90
102
```js
91
103
bst.delete(10);
92
104
bst.delete(20);
93
105
```
94
106
95
107
# <aname="graph"></a> Graph
96
108
Import Graph class and instantiate it and create an object of adjacency list implementation of Graph. To create a directed graph pass the string argument '**directed**'. If the Graph class is called without a parameter then by default its undirected graph.
0 commit comments