Re: [algogeeks] Re: quick sort

2011-01-05 Thread mo...@ismu
selecting pivot as a near median using order stastics method(O(n)) we can run it in worst case O(nlogn) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this

Re: [algogeeks] number

2010-12-21 Thread mo...@ismu
void main(int arg,char *argc) { char *s=argc[1]; int count=0,i; for(i=strlen(s)-1;i=0;i--) { count++; printf(%c,s[i]); if(count==3) { count=0; putchar(','); } } } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] complete tree

2010-12-21 Thread mo...@ismu
it takes O(n) and also O(n)extra space(queue) On Wed, Dec 22, 2010 at 12:37 PM, Saurabh Koar saurabhkoar...@gmail.comwrote: Find the first node whose left child is NULL or Right child is NULL using BFS.(As the tree is complete,all nodes before this will have two children).Insert at that node.

Re: [algogeeks] 1s and 0s

2010-12-21 Thread mo...@ismu
count the no of bits lets say n then answer becomes 2^n-1 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] Re: Valid Array

2010-12-09 Thread mo...@ismu
prims check for this case [1,1,4,4] -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For

Re: [algogeeks] Re: Valid Array

2010-12-09 Thread mo...@ismu
i did nt get this xor part in adithya solution check if this works array is valid if satisfy 2 conditions 1.max-min=n-1 2.there should be no repeatations first one can be done in O(n) for second check 1xor2xor...xorn=(a[1]-min+1)xor(a[2]-min+1)xor.. if both are equal there are

Re: [algogeeks] Amazom interview question

2010-12-04 Thread mo...@ismu
sort the jobs according to their starting time and check wheather a job starting time is less than its previous job ending time -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com.

Re: [algogeeks] Knapsack problem

2010-10-30 Thread mo...@ismu
@rashmi u missed p7 i took it as 2 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For

Re: [algogeeks] Re: Yahoo coding round question

2010-10-29 Thread mo...@ismu
@ravindara yeah this works perfect -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For

Re: [algogeeks] Re: how would you find the integer pairs which sum to m in o(n) time complexity

2010-10-25 Thread mo...@ismu
@preethika bettter to do it while inserting itself -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] Re: how would you find the integer pairs which sum to m in o(n) time complexity

2010-10-25 Thread mo...@ismu
u check only that element and continue inserting other elements ex m=4 elements 5 3 2 7 1 2 ... (3,1) will be found while inseting 1 , not 3 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Re: how would you find the integer pairs which sum to m in o(n) time complexity

2010-10-25 Thread mo...@ismu
@preethika (3,1) is found while inserting 1 and (2,2) will be found while inserting second 2 (which is at last position) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To