First, we need a class of node objects. These objects contain the data representing the objects being stored (employees in an employee database, for example) and also references to each of the node’s two children. Here’s how that looks:

class Node{

int iData; //data used as key value

float fData; //other data

node leftChild; //this node’s left child

node rightChild; //this node’s right child



There are other approaches to designing class Node. Instead of placing the data items directly into the node, you could use a reference to an object representing the data item:

class Node{

Person p1; //reference to person object

node leftChild; //this node’s left child

node rightChild; // this node’s right child


class person{

int iData;

float fData;


Node of Binary Search Tree
It's only fair to share...Share on FacebookTweet about this on TwitterShare on LinkedInShare on Google+Email this to someonePrint this page
Tagged on:     

One thought on “Node of Binary Search Tree

  • October 21, 2016 at 10:54 AM

    Wow that was unusual. I just wrote an extremely long comment but after I clicked submit my comment didn’t appear. Grrrr… well I’m not writing all that over again. Anyway, just wanted to say wonderful blog!|


Leave a Reply

Your email address will not be published. Required fields are marked *