Re: [algogeeks] MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space.
@navin and @atul: inorder traversal without recursion and stack can be done using Morris traversal in O(1) space. Refer the following link for Morris traversal http://www.geeksforgeeks.org/archives/6358 now the problem takes O(n) time and O(1) space. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space.
@all: Now the problem is for getting O(n) time and O(1) space we have to run two inorder traversal simultaneously. How can we do it?? On Mon, Sep 3, 2012 at 9:31 PM, Karthikeyan V.B kartmu...@gmail.com wrote: @navin and @atul: inorder traversal without recursion and stack can be done using Morris traversal in O(1) space. Refer the following link for Morris traversal http://www.geeksforgeeks.org/archives/6358 now the problem takes O(n) time and O(1) space. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space.
@Karthikeyan : thanks for the reminder.i totally forgot about Morris traversal.. i tried to tweak the code provided here : http://www.geeksforgeeks.org/archives/6358 This will meets the constraints , here is the code:- http://ideone.com/yp0jI unfortunately there is one thing which i am not able to figure out... as you can see i am using *goto* in the code.. it is not working if i use *continue* , i am not able figure out ...why this happening as using continue will make no effect.. may be i am missing something , so please help me in removing goto from the code. try running same code with continue instead of goto for input N=40. On Tue, Sep 4, 2012 at 12:56 PM, Navin Kumar algorithm.i...@gmail.comwrote: @all: Now the problem is for getting O(n) time and O(1) space we have to run two inorder traversal simultaneously. How can we do it?? On Mon, Sep 3, 2012 at 9:31 PM, Karthikeyan V.B kartmu...@gmail.comwrote: @navin and @atul: inorder traversal without recursion and stack can be done using Morris traversal in O(1) space. Refer the following link for Morris traversal http://www.geeksforgeeks.org/archives/6358 now the problem takes O(n) time and O(1) space. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space.
@Dave : algo seems fine...but it seems to me that it would difficult to maintain both left to right and right to left parallel way :( :( . it would be gr8 if you can provided little bit of coded algorithm for it. On Mon, Sep 3, 2012 at 10:36 AM, Dave dave_and_da...@juno.com wrote: @Atul007: No need to destroy the BST. Perform two simultaneous inorder traversals of the BST, one from left to right (the usual direction) and one from right to left. At any stage you have selected two nodes. If the sum is less than the given number, advance the left-to-right traversal; If the sum is greater, advance the right-to-left traversal. Quit with success when the sum equals the given number or with failure when the two traversals have reached the same node. Dave On Sunday, September 2, 2012 11:00:42 PM UTC-5, atul007 wrote: convert BST to sorted DLL.. now it is a double linked list , so we can find 2 number in O(n) time by keeping 2 pointers(one at start and one at end) from sorted DLL. now convert DLL to BST. On Mon, Sep 3, 2012 at 1:32 AM, Navin Kumar algorit...@gmail.com wrote: MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/oizd-5CSfuoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space.
what is right to left inorder? Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Mon, Sep 3, 2012 at 1:13 PM, atul anand atul.87fri...@gmail.com wrote: @Dave : algo seems fine...but it seems to me that it would difficult to maintain both left to right and right to left parallel way :( :( . it would be gr8 if you can provided little bit of coded algorithm for it. On Mon, Sep 3, 2012 at 10:36 AM, Dave dave_and_da...@juno.com wrote: @Atul007: No need to destroy the BST. Perform two simultaneous inorder traversals of the BST, one from left to right (the usual direction) and one from right to left. At any stage you have selected two nodes. If the sum is less than the given number, advance the left-to-right traversal; If the sum is greater, advance the right-to-left traversal. Quit with success when the sum equals the given number or with failure when the two traversals have reached the same node. Dave On Sunday, September 2, 2012 11:00:42 PM UTC-5, atul007 wrote: convert BST to sorted DLL.. now it is a double linked list , so we can find 2 number in O(n) time by keeping 2 pointers(one at start and one at end) from sorted DLL. now convert DLL to BST. On Mon, Sep 3, 2012 at 1:32 AM, Navin Kumar algorit...@gmail.comwrote: MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/oizd-5CSfuoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space.
@dave same doubt as @atul, how we can manage both function parallel and to all can we traverse a tree using some looping instead of traditional recursive methods..?? On Mon, Sep 3, 2012 at 1:13 PM, atul anand atul.87fri...@gmail.com wrote: @Dave : algo seems fine...but it seems to me that it would difficult to maintain both left to right and right to left parallel way :( :( . it would be gr8 if you can provided little bit of coded algorithm for it. On Mon, Sep 3, 2012 at 10:36 AM, Dave dave_and_da...@juno.com wrote: @Atul007: No need to destroy the BST. Perform two simultaneous inorder traversals of the BST, one from left to right (the usual direction) and one from right to left. At any stage you have selected two nodes. If the sum is less than the given number, advance the left-to-right traversal; If the sum is greater, advance the right-to-left traversal. Quit with success when the sum equals the given number or with failure when the two traversals have reached the same node. Dave On Sunday, September 2, 2012 11:00:42 PM UTC-5, atul007 wrote: convert BST to sorted DLL.. now it is a double linked list , so we can find 2 number in O(n) time by keeping 2 pointers(one at start and one at end) from sorted DLL. now convert DLL to BST. On Mon, Sep 3, 2012 at 1:32 AM, Navin Kumar algorit...@gmail.comwrote: MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/oizd-5CSfuoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Thanks and Regards: Rahul Kumar Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro M.Tech, School of Information Technology Indian Institute of Technology, Kharagpur-721302, Indiahttp://www.iitkgp.ac.in/ Mobile No: +91-8798049298, +91-9424738542 Alternate Email: rahulkumarpa...@hotmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space.
@ashish : i.e in decreasing order inorder(root) if not null inorder(root-right); inorder(root-left); On Mon, Sep 3, 2012 at 4:35 PM, Rahul Kumar Patle patlerahulku...@gmail.com wrote: @dave same doubt as @atul, how we can manage both function parallel and to all can we traverse a tree using some looping instead of traditional recursive methods..?? On Mon, Sep 3, 2012 at 1:13 PM, atul anand atul.87fri...@gmail.comwrote: @Dave : algo seems fine...but it seems to me that it would difficult to maintain both left to right and right to left parallel way :( :( . it would be gr8 if you can provided little bit of coded algorithm for it. On Mon, Sep 3, 2012 at 10:36 AM, Dave dave_and_da...@juno.com wrote: @Atul007: No need to destroy the BST. Perform two simultaneous inorder traversals of the BST, one from left to right (the usual direction) and one from right to left. At any stage you have selected two nodes. If the sum is less than the given number, advance the left-to-right traversal; If the sum is greater, advance the right-to-left traversal. Quit with success when the sum equals the given number or with failure when the two traversals have reached the same node. Dave On Sunday, September 2, 2012 11:00:42 PM UTC-5, atul007 wrote: convert BST to sorted DLL.. now it is a double linked list , so we can find 2 number in O(n) time by keeping 2 pointers(one at start and one at end) from sorted DLL. now convert DLL to BST. On Mon, Sep 3, 2012 at 1:32 AM, Navin Kumar algorit...@gmail.comwrote: MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/oizd-5CSfuoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Thanks and Regards: Rahul Kumar Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro M.Tech, School of Information Technology Indian Institute of Technology, Kharagpur-721302, Indiahttp://www.iitkgp.ac.in/ Mobile No: +91-8798049298, +91-9424738542 Alternate Email: rahulkumarpa...@hotmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space.
@all: If we are doing inorder traversal , it will automatically take O(n) space for internal stack. On Mon, Sep 3, 2012 at 5:17 PM, atul anand atul.87fri...@gmail.com wrote: @ashish : i.e in decreasing order inorder(root) if not null inorder(root-right); inorder(root-left); On Mon, Sep 3, 2012 at 4:35 PM, Rahul Kumar Patle patlerahulku...@gmail.com wrote: @dave same doubt as @atul, how we can manage both function parallel and to all can we traverse a tree using some looping instead of traditional recursive methods..?? On Mon, Sep 3, 2012 at 1:13 PM, atul anand atul.87fri...@gmail.comwrote: @Dave : algo seems fine...but it seems to me that it would difficult to maintain both left to right and right to left parallel way :( :( . it would be gr8 if you can provided little bit of coded algorithm for it. On Mon, Sep 3, 2012 at 10:36 AM, Dave dave_and_da...@juno.com wrote: @Atul007: No need to destroy the BST. Perform two simultaneous inorder traversals of the BST, one from left to right (the usual direction) and one from right to left. At any stage you have selected two nodes. If the sum is less than the given number, advance the left-to-right traversal; If the sum is greater, advance the right-to-left traversal. Quit with success when the sum equals the given number or with failure when the two traversals have reached the same node. Dave On Sunday, September 2, 2012 11:00:42 PM UTC-5, atul007 wrote: convert BST to sorted DLL.. now it is a double linked list , so we can find 2 number in O(n) time by keeping 2 pointers(one at start and one at end) from sorted DLL. now convert DLL to BST. On Mon, Sep 3, 2012 at 1:32 AM, Navin Kumar algorit...@gmail.comwrote: MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/oizd-5CSfuoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Thanks and Regards: Rahul Kumar Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro M.Tech, School of Information Technology Indian Institute of Technology, Kharagpur-721302, Indiahttp://www.iitkgp.ac.in/ Mobile No: +91-8798049298, +91-9424738542 Alternate Email: rahulkumarpa...@hotmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space.
@navin : if O(n) recursive stack is not allowed then i wonder how can it can be solved. On 9/3/12, Navin Kumar algorithm.i...@gmail.com wrote: @all: If we are doing inorder traversal , it will automatically take O(n) space for internal stack. On Mon, Sep 3, 2012 at 5:17 PM, atul anand atul.87fri...@gmail.com wrote: @ashish : i.e in decreasing order inorder(root) if not null inorder(root-right); inorder(root-left); On Mon, Sep 3, 2012 at 4:35 PM, Rahul Kumar Patle patlerahulku...@gmail.com wrote: @dave same doubt as @atul, how we can manage both function parallel and to all can we traverse a tree using some looping instead of traditional recursive methods..?? On Mon, Sep 3, 2012 at 1:13 PM, atul anand atul.87fri...@gmail.comwrote: @Dave : algo seems fine...but it seems to me that it would difficult to maintain both left to right and right to left parallel way :( :( . it would be gr8 if you can provided little bit of coded algorithm for it. On Mon, Sep 3, 2012 at 10:36 AM, Dave dave_and_da...@juno.com wrote: @Atul007: No need to destroy the BST. Perform two simultaneous inorder traversals of the BST, one from left to right (the usual direction) and one from right to left. At any stage you have selected two nodes. If the sum is less than the given number, advance the left-to-right traversal; If the sum is greater, advance the right-to-left traversal. Quit with success when the sum equals the given number or with failure when the two traversals have reached the same node. Dave On Sunday, September 2, 2012 11:00:42 PM UTC-5, atul007 wrote: convert BST to sorted DLL.. now it is a double linked list , so we can find 2 number in O(n) time by keeping 2 pointers(one at start and one at end) from sorted DLL. now convert DLL to BST. On Mon, Sep 3, 2012 at 1:32 AM, Navin Kumar algorit...@gmail.comwrote: MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/oizd-5CSfuoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Thanks and Regards: Rahul Kumar Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro M.Tech, School of Information Technology Indian Institute of Technology, Kharagpur-721302, Indiahttp://www.iitkgp.ac.in/ Mobile No: +91-8798049298, +91-9424738542 Alternate Email: rahulkumarpa...@hotmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space.
-- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/aLuPUOKxmaoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space.
convert BST to sorted DLL.. now it is a double linked list , so we can find 2 number in O(n) time by keeping 2 pointers(one at start and one at end) from sorted DLL. now convert DLL to BST. On Mon, Sep 3, 2012 at 1:32 AM, Navin Kumar algorithm.i...@gmail.comwrote: -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/aLuPUOKxmaoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space.
@Atul007: No need to destroy the BST. Perform two simultaneous inorder traversals of the BST, one from left to right (the usual direction) and one from right to left. At any stage you have selected two nodes. If the sum is less than the given number, advance the left-to-right traversal; If the sum is greater, advance the right-to-left traversal. Quit with success when the sum equals the given number or with failure when the two traversals have reached the same node. Dave On Sunday, September 2, 2012 11:00:42 PM UTC-5, atul007 wrote: convert BST to sorted DLL.. now it is a double linked list , so we can find 2 number in O(n) time by keeping 2 pointers(one at start and one at end) from sorted DLL. now convert DLL to BST. On Mon, Sep 3, 2012 at 1:32 AM, Navin Kumar algorit...@gmail.comjavascript: wrote: MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/oizd-5CSfuoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.