What is a Binary Tree in C++ and how would a node be inserted in each list?
What is a Binary Tree in C++ and how would a node be inserted in each list?
A Binary Tree is a general data structure, not some C++ thing. You could implement a binary tree in C++. You can google or wiki binary tree. As for inserting a node, umm... usually a node is implemented in a structure like this:
In the structure, you have a pointer to the left subtree and a pointer to the right subtree. U can just set the "left" or "right" pointer to insert it.Code:struct node{ int data; //it can be any kind of data, I'm just using int as an example node *left; node *right; }