Thread: C++ Question aboutBinary tree ?

  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    2

    C++ Question aboutBinary tree ?

    What is a Binary Tree in C++ and how would a node be inserted in each list?

  2. #2
    Registered User
    Join Date
    Jan 2010
    Posts
    30
    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:

    Code:
    struct node{
       int data; //it can be any kind of data, I'm just using int as an example
       node *left;
       node *right; 
    }
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question about computing the number of nodes in a Binary Tree
    By Overworked_PhD in forum C Programming
    Replies: 3
    Last Post: 12-12-2009, 01:10 PM
  2. Resource manager tree
    By VirtualAce in forum Game Programming
    Replies: 23
    Last Post: 09-07-2007, 10:27 PM
  3. Newb question about tree in c++...
    By azncoolj2000 in forum C++ Programming
    Replies: 5
    Last Post: 11-16-2005, 05:22 PM
  4. Binary Tree, couple questions
    By scoobasean in forum C Programming
    Replies: 3
    Last Post: 03-12-2005, 09:09 PM
  5. Tree traversal
    By recluse in forum C Programming
    Replies: 4
    Last Post: 12-05-2004, 04:00 PM