A general tree is an unordered hierarchical data structure with unlimited children nodes for each parent. A binary tree only has a maximum of two children nodes for each parent, commonly called left node and right node.
Converting from tree to binary tree would simply require that you start with the root node and start copying each node into the binary tree. The only rules would be that each node cannot have more than two children, including the root node.
You alo need to know a little about the target binary tree, such as should it be ordered? Should it be complete?
--
I am just adding few more points to this answer.
In Binary tree each node can have 0,1,2 children. The number children can;t exceed 2, where as in ordinary tree node can have any number of children. So while concerting ordinary tree we should fix the maximum number of nodes.
This is the information i found found from( All the credits goes the original Author, since i forgot original URL, i am pasting contents as it is)
General Trees and Conversion to Binary Trees
General trees are those in which the number of subtrees for any node is not
required to be 0, 1, or 2. The tree may be highly structured and therefore
have 3 subtrees per node in which case it is called a ternary tree.
However, it is often the case that the number of subtrees for any node may
be variable. Some nodes may have 1 or no subtrees, others may have 3, some
4, or any other combination. The ternary tree is just a special case of a
general tree (as is true of the binary tree).
General trees can be represented as ADT's in whatever form they exist.
However, there are some substantial problems. First, the number of references
for each node must be equal to the maximum that will be used in the tree.
Obviously, some real problems are presented when another subtree is added to
a node which already has the maximum number attached to it. It is also
obvious that most of the algorithms for searching, traversing, adding and
deleting nodes become much more complex in that they must now cope with
situations where there are not just two possibilities for any node but
multiple possibilities. It is also possible to represent a general tree in
a graph data structure (to be discussed later) but many of the advantages of
the tree processes are lost.
Fortunately, general trees can be converted to binary trees. They don't
often end up being well formed or full, but the advantages accrue from
being able to use the algorithms for processing that are used for binary
trees with minor modifications. Therefore, each node requires only two
references but these are not designated as left or right. Instead they are
designated as the reference to the first child and the reference to next
sibling. Therefore the usual left pointer really points to the first child
of the node and the usual right pointer points to the next sibling of the
node. One obvious saving in this structure is the number of fields which
must be used for references. In this way, moving right from a node accesses
the siblings of the node ( that is all of those nodes on the same level as
the node in the general tree). Moving left and then right accesses all of
the children of the node (that is the nodes on the next level of the general
tree).
Creating a Binary Tree from a General Tree
Since the references now access either the first child or successive siblings,
the process must use this type of information rather than magnitude as was
the case for the binary search tree. Note that the resulting tree is a
binary tree but not a binary search tree.
The process of converting the general tree to a binary tree is as follows:
* use the root of the general tree as the root of the binary tree
* determine the first child of the root. This is the leftmost node in the
general tree at the next level
* insert this node. The child reference of the parent node refers to this
node
* continue finding the first child of each parent node and insert it below
the parent node with the child reference of the parent to this node.
* when no more first children exist in the path just used, move back to the
parent of the last node entered and repeat the above process. In other
words, determine the first sibling of the last node entered.
* complete the tree for all nodes. In order to locate where the node fits
you must search for the first child at that level and then follow the
sibling references to a nil where the next sibling can be inserted. The
children of any sibling node can be inserted by locating the parent and then
inserting the first child. Then the above process is repeated.
Traversing the Tree
Since the general tree has now been represented as a binary tree the
algorithms which were used for the binary tree can now be used for the
general tree (which is actually a binary tree). In-order traversals make no
sense when a general tree is converted to a binary tree. In the general
tree each node can have more than two children so trying to insert the
parent node in between the children is rather difficult, especially if there
are an odd number of children.
Pre-order
This is a process where the root is accessed and processed and then each of
the subtrees is preorder processed. It is also called a depth-first
traversal. With the proper algorithm which prints the contents of the nodes
in the traversal it is possible to obtain the original general tree. The
algorithm has the following general steps:
* process the root node and move left to the first child.
* each time the reference moves to a new child node, the print should be
indented one tab stop and then the node processed
* when no more first children remain then the processing involves the right
sub-tree of the parent node. This is indicated by the nil reference to
another first child but a usable reference to siblings. Therefore the first
sibling is accessed and processed.
* if this node has any children they must be processed before moving on to
other siblings. Therefore the number of tabs is increased by one and the
siblings processed. If there are no children the processing continues
through the siblings.
* each time a sibling list is exhausted and a new node is accessed the
number of tab stops is decreased by one.
In this way the resulting printout has all nodes at any given level starting
in the same tab column. It is relatively easy to draw lines to produce the
original general tree except that the tree is on its side with it's root at
the left rather than with the root at the top.
will remain same
A binary tree is a type of tree data structure in which each node has at most two children. To convert a tree to a binary tree, we can follow these steps: Choose a root node for the binary tree. This will be the node at the top of the tree, and all other nodes will be connected to it. For each child node of the root node, add it as a left or right child of the root node, depending on its position relative to the root node. For each child node of the root node, repeat step 2 for its child nodes, adding them as left or right children of the appropriate parent node.
Binary tree is a tree where each node has one or two children.While in case of general tree, a node can have more than two children.A binary tree can be empty, whereas the general tree cannot be empty
A binary tree is type of tree with finite number of elements and is divided into three main parts. the first part is called root of the tree and itself binary tree which exists towards left and right of the tree. There are a no. of binary trees and these are as follows : 1) rooted binary tree 2) full binary tree 3) perfect binary tree 4) complete binary tree 5) balanced binary tree 6) rooted complete binary tree
Yes.
Is another binary tree.
no they are not same
What are the applications of Binary Tree.
a binary tree with only left sub trees is called as left skewed binary tree
It's the process of stepping through each node of a binary tree so that you reach each one at least once. Binary tree traversal is special in that the output of the tree is sorted. If you're looking for how it is done, I would highly recommend reading up on binary trees. It is easy to describe in pictures or code. I recommend against trying to get a description in text, it would only be confusing.
Incomplete Binary Tree is a type of binary tree where we do not apply the following formula: 1. The Maximum number of nodes in a level is 2
Complete Binary tree: -All leaf nodes are found at the tree depth level -All nodes(non-leaf) have two children Strictly Binary tree: -Nodes can have 0 or 2 children