Algorithm for Converting N-ary tree to Binary Tree

1,270 views
Skip to first unread message

Jay Parikh

unread,
Apr 29, 2013, 11:55:25 AM4/29/13
to wncc...@googlegroups.com
Dear All,

Do you have any idea how to convert N-ary Tree to Binary Tree ?

I need algorithm.

Thanks in advance.

--
Thanks and Regards,
Jay Parikh,
Research Assistant,
FOSSEE,
IIT-Bombay.

Nikul Prajapati

unread,
Apr 30, 2013, 5:20:01 AM4/30/13
to wncc...@googlegroups.com
Refer to this paper. It has algo. to convert n-ary tree to its equivalent binary tree.



--
--
The website for the club is http://stab-iitb.org/wncc
To post to this group, send email to wncc...@googlegroups.com
 
---
You received this message because you are subscribed to the Google Groups "Web and Coding Club IIT Bombay" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wncc_iitb+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

aayush singhal

unread,
Apr 30, 2013, 4:58:14 AM4/30/13
to wncc...@googlegroups.com
how about convert it to sorted 1D array, and then convert array to a binary tree

Avishek Dan

unread,
Apr 30, 2013, 5:24:38 AM4/30/13
to wncc...@googlegroups.com
1. Create L to R sibling pointers at each level 
2. Remove all but the leftmost child pointer of each node
3. Make the sibling pointer the right pointer.

--
--
The website for the club is http://stab-iitb.org/wncc
To post to this group, send email to wncc...@googlegroups.com
 
---
You received this message because you are subscribed to the Google Groups "Web and Coding Club IIT Bombay" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wncc_iitb+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Avishek Dan
M. Tech. II
Center for Indian Language Technology
Dept. of Computer Science and Engineering
Indian Institute of Technology Bombay

Nikul Prajapati

unread,
Apr 30, 2013, 5:29:43 AM4/30/13
to wncc...@googlegroups.com
@Avishek Dan : Ya this algo. will do


On Tue, Apr 30, 2013 at 2:58 PM, Nikul Prajapati <welcom...@gmail.com> wrote:
But resultant 2-ary tree should preserve some properties of original
n-ary tree.



On Tue, Apr 30, 2013 at 2:28 PM, aayush singhal <aayushs...@gmail.com> wrote:
how about convert it to sorted 1D array, and then convert array to a binary tree

--

Nikul Prajapati

unread,
Apr 30, 2013, 5:28:40 AM4/30/13
to wncc...@googlegroups.com
But resultant 2-ary tree should preserve some properties of original
n-ary tree.

On Tue, Apr 30, 2013 at 2:28 PM, aayush singhal <aayushs...@gmail.com> wrote:
how about convert it to sorted 1D array, and then convert array to a binary tree

--
Reply all
Reply to author
Forward
0 new messages