GfG QA is closing soon... Please refer PRACTICE or GfG now on wards !!

Implementation of Binary tree

Hi all, 

I am very new to data structures and learning the concepts of it. When start with learning the concept of binary trees i could see the implementation for creating a binary tree is direct.

For example 

In order to create a Binary tree the idea used is.

Node *root = newnode(x);

root->left = newnode(x);

root->right =  newnode(x);

root->left->left =  newnode(x);

root->left->right= newnode(x);

root->right->left =  newnode(x);

root->right->right= newnode(x);

Now my question is how to make this generic. What are conditions i need to use in order to construct a binary tree not a binary search tree?



asked Jun 7, 2016 by Balaji Ravi