DEV Community

Oscar Luna
Oscar Luna

Posted on • Edited on

JavaScript Data Structures and Algorithms (Trees, part 1)

Hello! In this 5th post about JavaScript data structures and algorithms I will be discussing trees and how we run insert, append, prepend, traverse, and delete operations for then. ...

Trees are data structures that consist of a parent node, and two child nodes, referred to as the left child and right child, respectively:


class Node {
  constructor(value){
    this.left = null;
    this.right = null;
    this.value = value;
  }
}

class BinarySearchTree {
  constructor(){
    this.root = null;
  }
    ...
}

Enter fullscreen mode Exit fullscreen mode

}
}
}



Enter fullscreen mode Exit fullscreen mode

Top comments (0)