Re: [algogeeks] Suffix Tree In O(n)

2010-07-09 Thread vadivel selvaraj
Dis can help u http://www.allisons.org/ll/AlgDS/Tree/Suffix/ On Fri, Jul 9, 2010 at 9:36 PM, amit amitjaspal...@gmail.com wrote: Hi can anybody tell me how to construct a suffix tree in O(n) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

Re: [algogeeks] trees

2010-06-15 Thread vadivel selvaraj
Dis'd do :-D int klargest_recur(int k,List* head) { if(!head || !k) return -1; int rsize = 0; if(head-right) rsize = size(head-right); if(k == rsize + 1) return head-data; if(k = rsize) return klargest_recur(k, head-right); else return klargest_recur(k - rsize - 1,

Re: [algogeeks] sorting

2010-06-13 Thread vadivel selvaraj
@ sharad... DO u mean the former has got unused space in which the latter can occupy On Sun, Jun 13, 2010 at 11:02 AM, harit agarwal agarwalha...@gmail.comwrote: sort both arrays separetely and then perform merge operation ..it is O(mlogm+nlog)... -- You received this message because

Re: [algogeeks] isomorphic trees

2010-06-08 Thread vadivel selvaraj
bool isIsomorphic(List* h1,List* h2) { if(!h1 !h2) return true; if(h1 h2) return(h1-data == h2-data isIsomorphic(h1-left,h2-right) isIsomorphic(h1-right,h2-left)); else return false; } On Tue, Jun 8, 2010 at 8:31 PM, divya sweetdivya@gmail.com wrote: Two

Re: [algogeeks] ds

2010-06-07 Thread vadivel selvaraj
Hi guys d soln z quite easy by swapping the variables.. consider a1a2a3a4b1b2b3b4 In the first iteration, swap (a2,b1),(a4,b3) giving a1b1a3b3a2b2a4b4 In the second iteration, swap (a3b3,a2b2) which gives d soln... a1b1a2b2a3b3a4b4... Any comments on dis?? On Mon, Jun 7, 2010 at 1:51 PM, Raj N