I have to make a tree that will have unlimited leafs in each root.
I don't have much experience in binary trees and i am confused on how to make this tree.
Can you help me please?
Binary trees have 2 branches (max) at each node. To store an arbitrary number of links you need an expandable data structure, like a vector.
>I have to make a tree that will have unlimited leafs in each root.
A tree has a single, unique root node (how about in each root? ;)).
It's not a problem to make a tree with unlimited number of branches in each node (for example, use vector of pointers to nodes). The problem is: what's a required interface to this tree data structure? In other words, what do you want to do with this data structure?
Think again about your true assignment then come back...
For the next tips, I will assume that you know object-oriented programming:
1) Think about how you will represent your tree. I suggest that you take a pencil and a paper and draw a binary tree.
2) What will you do on the tree? (Insertion, deletion, ...) How will the structure react? Again, draw it to see more clearly.
3) And now, the technical part. Will you use pointers, vectors, etc.? Will you use a BinaryTree class, a TreeLevel class, a Node class, a Leaf class? Your previous drawings and the operations will determine what the correct representation will be.