BST Nodes
by black strings
HTML
<!-- linked list swithcing test -->
CSS
body {
background-color:#111111;
}
JavaScript
class Node {
constructor(value){
this.value = value;
this.prev = null;
this.next = null;
}
insert(node){
if(node.value < this.value){
} else {
}
}
setNext(node){
this.next = node;
}
setPrevious(node){
this.prev = node;
}
}
class BST {
constructor(){
this.root;
this.last;
}
insert(node){
if(!this.root){
this.root = node;
} else {
this.root.insert(node);
}
}
}
var a = new Node(1);
var b = new Node(2);
var c = new Node(3);
var d = new Node(4);
var bst = new BST();
bst.insert(a);
bst.insert(b);
bst.insert(c);
bst.insert(d);
console.log(bst);