mockers
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Binary tree to Linked List

3 posters

Go down

Binary tree to Linked List Empty Binary tree to Linked List

Post  shivang Mon Feb 02, 2009 3:44 am

Convert a Binary tree to Linked list
shivang
shivang

Posts : 42
Join date : 2009-01-30
Age : 35

Back to top Go down

Binary tree to Linked List Empty Re: Binary tree to Linked List

Post  mnnit.rahul Mon Feb 02, 2009 3:43 pm

is should be doubly link list

mnnit.rahul

Posts : 51
Join date : 2009-02-01

Back to top Go down

Binary tree to Linked List Empty @shivang

Post  ballu Mon Feb 02, 2009 7:16 pm

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
ballu
ballu

Posts : 58
Join date : 2009-02-01

Back to top Go down

Binary tree to Linked List Empty Re: Binary tree to Linked List

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum