[algogeeks] Re: interval intersection

2006-08-11 Thread BruceYang
The Interval tree (kind of BST datastructure) works. --~--~-~--~~~---~--~~ 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

[algogeeks] interval intersection

2006-08-11 Thread [EMAIL PROTECTED]
Given a set of intervals, (a,b)s some of which could have overlap, what is the best way to find the common sub-interval which overlaps most number of intervals (a,b) ? There could be more than one such sub-interval and algo should return all such sub-intervals. For example, (1, 5), (2, 6), (3, 8)

[algogeeks] Re: hi..plz solve this..

2006-08-11 Thread Kamlesh
Btw this is just O(n) Algo as no of swaps are restricted to N-2 overall. Kamlesh --~--~-~--~~~---~--~~ 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.

[algogeeks] Re: hi..plz solve this..

2006-08-11 Thread Kamlesh
Hi all, This is c code for the orginal problem.. I is working fine! fuction(int a[], int N){ int swaps=0, i; for(i=1;(i < N/2) && (swaps < N-2); i+=2) { int p=i, temp=a[i], inside=0, t; while(p!=i || ! inside){ inside=1; p= (p >= N/2) ? 2*p-N+1 : 2*p; t=a[p]; a[p]=te