Javarevisited
Published in

Javarevisited

Binary Search Trees

Introduction to Binary Search Trees

Tree Structure
  • The right subtree of a node contains only keys that are greater than the node’s key.
  • Left and right subtree each must also be a binary search tree.
  • The structural linkages that exist in the supplied data set should be reflected.
  • Compared to linked lists and arrays, make insertion and deletion faster.
  • A versatile method of storing and transporting data.
  • It can store a large number of nodes.
class Node {
int value;
Node leftChild;
Node rightChild;
Node(int value) {
this.value = value;
rightChild = null;
leftChild = null;
}
}
public class BinaryTree {    Node root;    // ...
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store