Re: [algogeeks] Re: Microsoft written!!!
apply BFS the node after the particular node(whode cousin to be find) will be the required node On Wed, Aug 10, 2011 at 2:15 PM, Puneet Chawla wrote: > > Agree with mohit goel.. > > On Wed, Aug 10, 2011 at 11:22 AM, Mohit Goel wrote: > >>10 >> 4 5 >>2 7 6 11 >>1 39 8 12 13 14 15 >> >> >> i think we should first find the parent of the particular node ..then >> apply the concept as told by Brijesh on it >> >> p =parent(q); >> r = parent(p); >> count =1; >> while(p ==isright(r)) >> { >> p=r; >> r=parent(r); >> count++; >> if(r==root) >> break; >> >> } >> >> if(d =right(r)) >> { >> while(count!=0) >> { >> if(d->left) >> d=d->left; >> else d=d->right; >> count--; >> } >> } >> else return NULL; >> o/p=d->value; >> >> >> >> -- >> 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. >> > > > > -- > With regards > > Puneet Chawla > Computer Engineering Student > NIT Kurukshetra > > -- > 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.
[algogeeks] Tejas networks and MAQ
Hi if anyone recently faced written or interview of those companies then pls discuss here Thanks in advance -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- 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.
Re: [algogeeks] Re: problem regarding output??
It shows error in tc compiler We can't perform airthmetic opern on void* On Wed, Aug 10, 2011 at 10:08 AM, jagrati verma wrote: > (int *) it is derefrencing of any void pointer into > integer. > > -- > 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. > > -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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.
Re: [algogeeks] Re: Microsoft written!!!
Agree with mohit goel.. On Wed, Aug 10, 2011 at 11:22 AM, Mohit Goel wrote: >10 > 4 5 >2 7 6 11 >1 39 8 12 13 14 15 > > > i think we should first find the parent of the particular node ..then > apply the concept as told by Brijesh on it > > p =parent(q); > r = parent(p); > count =1; > while(p ==isright(r)) > { > p=r; > r=parent(r); > count++; > if(r==root) > break; > > } > > if(d =right(r)) > { > while(count!=0) > { > if(d->left) > d=d->left; > else d=d->right; > count--; > } > } > else return NULL; > o/p=d->value; > > > > -- > 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. > -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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.
[algogeeks] Re: m'th max element
nice logic :) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/-rdIH5FKbk8J. 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.
Re: [algogeeks] Re: SPOJ CENCRY
thanks nitin got AC...:) silliy mistake -- 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.
Re: [algogeeks] Re: SPOJ CENCRY
inp: 3 eee vfghjklwerf out: cjpvbhntzgm aeiouaeiouae eouaeioicou On Wed, Aug 10, 2011 at 12:40 PM, Nitin Nizhawan wrote: > 3 > eee > cjpvbhntzgm > > aeiouaeiouae > vfghjklwerf > eouaeioicou > > On Wed, Aug 10, 2011 at 12:06 PM, kartik sachan > wrote: > >> any body tell the test cases?? >> >> -- >> 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.
Re: [algogeeks] Re: SPOJ CENCRY
3 eee cjpvbhntzgm aeiouaeiouae vfghjklwerf eouaeioicou On Wed, Aug 10, 2011 at 12:06 PM, kartik sachan wrote: > any body tell the test cases?? > > -- > 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.
[algogeeks] Re: m'th max element
As Nitin Metioned Selection Algorithm is the best for this problem. Order of complexity is O(n) On Aug 9, 11:31 pm, Ankuj Gupta wrote: > We can use min heap. > 1) Build a Min Heap MH of the first m elements (arr[0] to arr[m-1]) of > the given array. O(m) > 2) For each element, after the mth element (arr[m] to arr[n-1]), > compare it with root of MH. > a) If the element is greater than the root then make it root and call > heapify for MH > b) Else ignore it. > O((n-m)*logm) > 3) Finally, MH has m largest elements and root of the MH is the mth > largest element. > > On Aug 8, 3:57 pm, vijay goswami wrote: > > > > > > > > > run bubble sort for m passes > > > On Mon, Aug 8, 2011 at 4:02 PM, Nitin Nizhawan > > wrote: > > > > Selection algorithm,http://en.wikipedia.org/wiki/Selection_algorithm > > > > On Mon, Aug 8, 2011 at 3:59 PM, nick wrote: > > > >> how will you find the m'th maximum element in an unsorted array of > > >> integers? > > > >> -- > > >> You received this message because you are subscribed to the Google Groups > > >> "Algorithm Geeks" group. > > >> To view this discussion on the web visit > > >>https://groups.google.com/d/msg/algogeeks/-/aYU_PfGHiNkJ. > > >> 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. -- 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.