is it not possible to traverse tree in order and store in array. then figure out the element and print the previous element?
On Fri, Aug 26, 2011 at 2:04 PM, Vikram Singh <singhvikram...@gmail.com>wrote: > i figured out algo to find the inorder predecessor of a bst without > using parent pointer... just wanna confirm if its missing any case.... > > if the left child(subtree) of node exist, then predecessor ll be the > max value in the left subtree. > > else predecessor ll be one of the ancestor.... in this case, starting > from the given node, we hv to find a closest ancestrous node which is > right child of its parent... the parent ll be the predecessor... > > and i made the parent implementation without changing the structure of > the node... using while loop... > > let me know if i m missing ant case... > > -- > 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.