can find one more solution in my blog.... http://pandey123.wordpress.com/
check it... and tell me if you have any doubt... On Sat, Jun 23, 2012 at 11:52 PM, Akshat Sapra <sapraaks...@gmail.com>wrote: > To do this question in O(n) time follow the post "Segment trees" in this > post of topcoder > > http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=lowestCommonAncestor > > > Here in this given algorithm preprocessing time in O(n) and query time is > O(log n). > > -- > > > Akshat Sapra > Under Graduation(B.Tech) > IIIT-Allahabad(Amethi Campus) > *--------------------------------------* > sapraaks...@gmail.com > akshatsapr...@gmail.com > rit20009008@ <rit20009...@gmail.com>iiita.ac.in > > -- > 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.