Binary tree to Linked List
3 posters
Page 1 of 1
Binary tree to Linked List
Convert a Binary tree to Linked list
shivang- Posts : 42
Join date : 2009-01-30
Age : 35
Re: Binary tree to Linked List
is should be doubly link list
mnnit.rahul- Posts : 51
Join date : 2009-02-01
@shivang
this is the great tree list problem that beagle was talking about
here is my logic
we can consider a recursive approach
consider a function Onleft and OnRight
which are same in the sense that they give linked representation of left and right sub-childs
OnLeft returns a pointer to the rightmost node that is the tail in left sub list
OnRight returns the head of right sub list
join the parent with the left and right sub-lists and return either the tail or head depending on the function being called
i will try and post the code
here is my logic
we can consider a recursive approach
consider a function Onleft and OnRight
which are same in the sense that they give linked representation of left and right sub-childs
OnLeft returns a pointer to the rightmost node that is the tail in left sub list
OnRight returns the head of right sub list
join the parent with the left and right sub-lists and return either the tail or head depending on the function being called
i will try and post the code
ballu- Posts : 58
Join date : 2009-02-01
Similar topics
» Linked List
» Sorting Algorithms
» Best Method to sort Linked List?
» left tree to right tree
» Binary Search:Vikas Sir
» Sorting Algorithms
» Best Method to sort Linked List?
» left tree to right tree
» Binary Search:Vikas Sir
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|