[algogeeks] Re: impossible microsoft puzzle
is there any clue on the no. of duplicates of a number. say, how many 1's or 2's are present at max. On Jul 3, 11:10 pm, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote: N people team up and decide on a strategy for playing this game. Then they walk into a room. On entry to the room, each person is given a hat on which one of the first N natural numbers is written. There may be duplicate hat numbers. For example, for N=3, the 3 team members may get hats labeled 2, 1, 2. Each person can see the numbers written on the others' hats, but does not know the number written on his own hat. Every person then simultaneously guesses the number of his own hat. What strategy can the team follow to make sure that at least one person on the team guesses his hat number correctly? -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: isbst
@Raj N It won't work for the tree like. your method would return true for the following tree. 13 / 12 \ 14 On Sat, Jul 3, 2010 at 3:45 AM, Raj N rajn...@gmail.com wrote: According to me perform inorder traversal and at every point store the current element in a temporary variable and check if the next element obtained is greater than temp otherwise return false int temp=-; int flag=1; void isBst(NODE *tree) { if (tree!=NULL) { isBst(tree-left); if (temptree-info) temp=tree-info; else { flag=0; return; } isBst(tree-right); } } Please correct me if I'm wrong On Fri, Jul 2, 2010 at 6:43 PM, sharad kumar sharad20073...@gmail.comwrote: i read that link ,i dont think that is very efficient,someone plzzz look at that soln n comment bcoz i m really confused in this isbst ques so plzzz -- 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.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@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: rotation
Have you guys seen following? http://geeksforgeeks.org/?p=2838 http://geeksforgeeks.org/?p=2398 http://geeksforgeeks.org/?p=2878 On Sat, Jul 3, 2010 at 12:12 PM, Pramod Negi negi.1...@gmail.com wrote: I guess you want the following juggling algorithm http://www.cs.bell-labs.com/cm/cs/pearls/s02b.pdf On Fri, Jul 2, 2010 at 11:16 PM, Dave dave_and_da...@juno.com wrote: @Jalaj. The original poster said, P.S---do not give block reversal method for array rotation Dave On Jul 2, 10:54 am, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote: reverse full array first then, reverse last k elemnts and initial n-k elements seperately this will do On Fri, Jul 2, 2010 at 8:34 PM, Ratnesh Thakur ratneshthaku...@gmail.comwrote: correction.. a[j]=a[j-1] instead of a[i]=a[i-1] On Fri, Jul 2, 2010 at 7:30 PM, Ratnesh Thakur ratneshthaku...@gmail.comwrote: i think this should work. for(i=1;i=k;i++) { var=a[n-1] for(j=n-1;j=1;j--) a[i]=a[i-1] a[0]=var } On Fri, Jul 2, 2010 at 5:36 PM, Saurabh Ahuja nsit.saur...@gmail.comwrote: a[0] = a[2] a[1] = a[3] a[2] = a[4] a[0] and a[1] has been changed a[3] = a[0] a[4] = a[1] so this solution would not work. On Fri, Jul 2, 2010 at 5:14 PM, Akash Gangil akashg1...@gmail.com wrote: wouldn't this work: for i in range(0,len) a[i] = a[(i+2)%5]; where len is the length of array On Sat, Jun 26, 2010 at 3:37 PM, sharad kumar sharad20073...@gmail.com wrote: i have to right rotate an array by k positions 1 2 3 4 5 for k=2 o/p shud be 3 4 5 1 2 P.S---do not give block reversal method for array rotation and soln must be inplace.plzz write ur logic also along with d code -- 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.comalgogeeks%2bunsubscr...@googlegroups.com algogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Best Regards Akash Gangil -- 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.comalgogeeks%2bunsubscr...@googlegroups.com algogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com algogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com algogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD- Hide quoted text - - Show quoted text - -- 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.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@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: impossible microsoft puzzle
can it be like... one person sees any other person's number and guesses it first. then, everybody else guesses the same number. this way, atleast one guesses it right, since there is no boundation on the no. of wrong guesses. On Jul 3, 11:10 pm, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote: N people team up and decide on a strategy for playing this game. Then they walk into a room. On entry to the room, each person is given a hat on which one of the first N natural numbers is written. There may be duplicate hat numbers. For example, for N=3, the 3 team members may get hats labeled 2, 1, 2. Each person can see the numbers written on the others' hats, but does not know the number written on his own hat. Every person then simultaneously guesses the number of his own hat. What strategy can the team follow to make sure that at least one person on the team guesses his hat number correctly? -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: number of 1's
no of bits set int v; int c; for(c=0;v;c++) v=v-1; this is best method without consideration of no of bits in an integer and for executes only the number of times the bit is set in the number// -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: isbst
@Dheeraj: It would return false. Initially temp=12, next temp=14, then it'll compare 13temp and flag becomes 0 and hence not bst. Am I wrong ?? On Sun, Jul 4, 2010 at 10:01 AM, Dheeraj Jain dheerajj...@gmail.com wrote: @Raj N It won't work for the tree like. your method would return true for the following tree. 13 / 12 \ 14 On Sat, Jul 3, 2010 at 3:45 AM, Raj N rajn...@gmail.com wrote: According to me perform inorder traversal and at every point store the current element in a temporary variable and check if the next element obtained is greater than temp otherwise return false int temp=-; int flag=1; void isBst(NODE *tree) { if (tree!=NULL) { isBst(tree-left); if (temptree-info) temp=tree-info; else { flag=0; return; } isBst(tree-right); } } Please correct me if I'm wrong On Fri, Jul 2, 2010 at 6:43 PM, sharad kumar sharad20073...@gmail.comwrote: i read that link ,i dont think that is very efficient,someone plzzz look at that soln n comment bcoz i m really confused in this isbst ques so plzzz -- 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.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@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: isbst
@dheeraj for this tree inorder is 12 14 13 first 12 comes,it is saved in temp now 14 comes since 1412 so temp =14 now when 13 comes which is less than temp hence not a bst correct me if i wrong -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] numbers
There is very long array of ints, and you are given pointer to base addr of this array.. each int is 16bit representation... you need to return the pointer to tht bit inside array where longest sequence of 1s start for example. if your array has following in bit representation: ,0111,0011,1110,,10111 then your longest sequence has 5 ones but the longest number has only 4 ones.(so finding highest num wnt wrk) -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] 2_D matrix
@amir ..could you please provide a rough pseudocode for it... :-? On Sun, Jul 4, 2010 at 3:12 AM, Amir hossein Shahriari amir.hossein.shahri...@gmail.com wrote: @jalaj: oops! i'm sorry but by diameter i meant diagonal! binary search on the diagonal 0 4 10 14 the result is 4910 so the matrix that ends with 4: 0 1 2 4 and the matrix that starts with 10: 10 11 13 14 can't have 9 in them so we continue the search in 3 7 5 8 and 6 9 8 12 applying the search on 3 7 5 8 we see that 89 which is the biggest element of the matrix so this can't have 9 in it and the search in 6 9 8 12 yields that 6912 so the result would be in 8 or 9 -- 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.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: merge sorted lists
@sharad in the first step you will have to merge k lists each of n size .. you will mwrge 2 at a time wouldn't that be O(n*k/2) so t(n)=n(k/2)+n(k/4)+.. correct me if i'm wrong anyways On Sun, Jul 4, 2010 at 9:56 AM, Dave dave_and_da...@juno.com wrote: @Sharad. Haven't you changed the roles of n and k? The original poster had n lists with average length k, meaning a total of n*k elements. You have k lists with a total of n elements, meaning that each list has an average of n/k elements. Dave On Jul 3, 1:02 pm, sharad kumar sharad20073...@gmail.com wrote: 1. First take two lists at a time and merge them so total elements parsed for all lists =O(n) This operation results in k/2 lists 2. Repeat steps till k/2 == 1. *Time complexity of above solution = O(n logk)* Step1 would loop through *logk *times and each operation would require parsing all n elements in all the lists for making k/2 lists eg:: if i had 8 lists then first pass would make 4 lists by parsing all n elements; second pass would make 2 lists by parsing again n elements and third pass would give 1 list again by parsing n elements. *Constraint of the above Solution* For merging we would require *O(n) *extra space. *Solution2: Without Using O(n) extra space; uses O(k) extra space* **j = 1; 1. (For all lists L[i]) { Take the jth element from each list and create a min heap in O(k) with the node data and index information. Take the minimum element from the heap in O(1) i.e. root node and put it in *List1 indexj.* **if the element didn't belong to list1[j] then swap it with list1[j] with list to which the min element belonged. Now increment the pointer j for the list l1(or to the list where in the min nodes are getting added) and add the new node to min heap} 2. Keep repeating steps 1 till all n elements are being looked up *Time Complexity = O(n logk ) SPACE = O(k)* At a time we have k elements min heap and for all n elements we have to readjust the heap in log(k) time so total time = *O(n logk )* and space used = *O(k)* -- 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.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] graphs again
A graph is given. You need to design a data structure with minimum space complexity such that it does the follows -- Finds whether nodes u and v have a path in between them in O(1) time. -- Finds whether there is a path of length k between u and v in O(k) time. The same data structure to be used for both the purposes. -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] 0 and 1 again :)
You are given an array ' containing 0s and 1s. Find O(n) time and O(1) space algorithm to find the maximum sub sequence which has equal number of 1s and 0s. Examples 1) 10101010 The longest sub sequence that satisfies the problem is the input itself 2)1101000 The longest sub sequence that satisfies the problem is 110100 My approach: in 1 go count the number of zero's and 1's .. find which is smaller then in the next scan take two count1 and count0 and start fetching o's and 1's upto you get them to the smaller count(calculated earlier) better answers ?? -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: merge sorted lists
@dave u r rite its my fault -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Yahoo
In a village in each family they give birth to children till they get a boy. IF girl child they try again. What is the ratio of boys to girls. -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Yahoo
it will be 1:1 On Sun, Jul 4, 2010 at 4:50 PM, Jitendra Kushwaha jitendra.th...@gmail.comwrote: it will be half... On Sun, Jul 4, 2010 at 4:18 PM, Piyush Verma 114piy...@gmail.com wrote: In a village in each family they give birth to children till they get a boy. IF girl child they try again. What is the ratio of boys to girls. -- 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.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Jitendra Kushwaha MNNIT, Allahabad -- 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.comalgogeeks%2bunsubscr...@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 algoge...@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] merge sorted lists
According to the problem there should be 'n * k' elements in all (on an average). For merging all the elements into a single list one has to look at all the elements at least once. (For eg in case of merging two lists of size n1 and n2, the worst case complexity in O(n1 + n2)). Extending to the multiple lists the complexity should be O(n k) atleast. We can merge two lists at a time. Say list1 and list 2 , list 3 and list 4 and so on... After this operation we will have (n/2) lists with 2k elements each. The time complexity of this set of merges in = (n/2) * (k + k) = nk. Now in the second pass (merging the resulting 2k length lists pairwise), we will have time complexity of (n/4) * (2k + 2k) = nk. Proceeding like this we will have , log n sets (passes) of merges. So complexity is O(nk log n). I have a gut feel that this should be the best we can do. Because if k = 1, we essentially have n single element lists. Merging them into one single list is equal to sorting them. For which the lower bound in n log n. On Sat, Jul 3, 2010 at 11:06, divya sweetdivya@gmail.com wrote: How do you merge n sorted lists with average length K in O(n*log(K)) 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. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@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: Yahoo
@peeyush: the ratio is based on probability, it will be 1: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 algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Yahoo
ya i mean half girl and half boys i.e. 1:1 ratio of boys to girl On Sun, Jul 4, 2010 at 5:25 PM, peeyush peeyush...@gmail.com wrote: It can not be determined. On Jul 4, 4:27 pm, Amit Jaspal amitjaspal...@gmail.com wrote: it will be 1:1 On Sun, Jul 4, 2010 at 4:50 PM, Jitendra Kushwaha jitendra.th...@gmail.comwrote: it will be half... On Sun, Jul 4, 2010 at 4:18 PM, Piyush Verma 114piy...@gmail.com wrote: In a village in each family they give birth to children till they get a boy. IF girl child they try again. What is the ratio of boys to girls. -- 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.comalgogeeks%2bunsubscr...@googlegroups.com algogeeks%2bunsubscr...@googlegroups.comalgogeeks%252bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Jitendra Kushwaha MNNIT, Allahabad -- 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.comalgogeeks%2bunsubscr...@googlegroups.com algogeeks%2bunsubscr...@googlegroups.comalgogeeks%252bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Jitendra Kushwaha MNNIT, Allahabad -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] هيفاء وهبي فيلمها الا باحي
[1][2][3][4]هيفاء وهبي فيلمها الاباحي[5]او http://bit.ly/cWhJJk هيفاء وهبي فيلمها الاباحي[6] هيفاء وهبي فيلمها الاباحي[7] هيفاء وهبي فيلمها الاباحي[8] هيفاء وهبي فيلمها الاباحي[9] هيفاء وهبي فيلمها الاباحي[10] هيفاء وهبي فيلمها الاباحي[11] هيفاء وهبي فيلمها الاباحي[12] هيفاء وهبي فيلمها الاباحي[13] هيفاء وهبي فيلمها الاباحي[14] هيفاء وهبي فيلمها الاباحي[15] هيفاء وهبي فيلمها الاباحي[16] هيفاء وهبي فيلمها الاباحي[17] هيفاء وهبي فيلمها الاباحي[18] هيفاء وهبي فيلمها الاباحي[19] هيفاء وهبي فيلمها الاباحي[20] هيفاء وهبي فيلمها الاباحي[21] هيفاء وهبي فيلمها الاباحي[22] هيفاء وهبي فيلمها الاباحي[23] هيفاء وهبي فيلمها الاباحي[24] هيفاء وهبي فيلمها الاباحي[25] هيفاء وهبي فيلمها الاباحي[26] هيفاء وهبي فيلمها الاباحي[27] هيفاء وهبي فيلمها الاباحي[28] هيفاء وهبي فيلمها الاباحي[29] هيفاء وهبي فيلمها الاباحي[30] هيفاء وهبي فيلمها الاباحي[31] هيفاء وهبي فيلمها الاباحي[32] هيفاء وهبي فيلمها الاباحي[33] هيفاء وهبي فيلمها الاباحي[34] هيفاء وهبي فيلمها الاباحي[35] هيفاء وهبي فيلمها الاباحي[36] هيفاء وهبي فيلمها الاباحي[37] هيفاء وهبي فيلمها الاباحي[38] هيفاء وهبي فيلمها الاباحي[39] هيفاء وهبي فيلمها الاباحي[40] هيفاء وهبي فيلمها الاباحي[41] هيفاء وهبي فيلمها الاباحي[42] هيفاء وهبي فيلمها الاباحي[43] هيفاء وهبي فيلمها الاباحي[44] هيفاء وهبي فيلمها الاباحي[45] هيفاء وهبي فيلمها الاباحي[46] هيفاء وهبي فيلمها الاباحي[47] هيفاء وهبي فيلمها الاباحي[48] هيفاء وهبي فيلمها الاباحي[49] هيفاء وهبي فيلمها الاباحي[50] هيفاء وهبي فيلمها الاباحي[51] هيفاء وهبي فيلمها الاباحي[52] هيفاء وهبي فيلمها الاباحي[53] هيفاء وهبي فيلمها الاباحي[54] هيفاء وهبي فيلمها الاباحي[55] هيفاء وهبي فيلمها الاباحي[56] هيفاء وهبي فيلمها الاباحي[57] هيفاء وهبي فيلمها الاباحي[58] هيفاء وهبي فيلمها الاباحي[59] هيفاء وهبي فيلمها الاباحي[60] هيفاء وهبي فيلمها الاباحي[61] هيفاء وهبي فيلمها الاباحي[62] هيفاء وهبي فيلمها الاباحي[63] هيفاء وهبي فيلمها الاباحي[64] هيفاء وهبي فيلمها الاباحي[65] هيفاء وهبي فيلمها الاباحي[66] هيفاء وهبي فيلمها الاباحي[67] هيفاء وهبي فيلمها الاباحي[68] هيفاء وهبي فيلمها الاباحي[69] هيفاء وهبي فيلمها الاباحي[70] هيفاء وهبي فيلمها الاباحي[71] هيفاء وهبي فيلمها الاباحي[72] هيفاء وهبي فيلمها الاباحي[73] هيفاء وهبي فيلمها الاباحي[74] هيفاء وهبي فيلمها الاباحي[75] هيفاء وهبي فيلمها الاباحي[76] هيفاء وهبي فيلمها الاباحي[77] هيفاء وهبي فيلمها الاباحي[78] هيفاء وهبي فيلمها الاباحي[79] هيفاء وهبي فيلمها الاباحي[80] هيفاء وهبي فيلمها الاباحي[81] هيفاء وهبي فيلمها الاباحي[82] هيفاء وهبي فيلمها الاباحي[83] هيفاء وهبي فيلمها الاباحي[84] هيفاء وهبي فيلمها الاباحي[85] هيفاء وهبي فيلمها الاباحي[86] هيفاء وهبي فيلمها الاباحي[87] هيفاء وهبي فيلمها الاباحي[88] هيفاء وهبي فيلمها الاباحي[89] هيفاء وهبي فيلمها الاباحي[90] هيفاء وهبي فيلمها الاباحي[91] هيفاء وهبي فيلمها الاباحي[92] هيفاء وهبي فيلمها الاباحي[93] هيفاء وهبي فيلمها الاباحي[94] هيفاء وهبي فيلمها الاباحي[95] هيفاء وهبي فيلمها الاباحي[96] هيفاء وهبي فيلمها الاباحي[97] هيفاء وهبي فيلمها الاباحي[98] هيفاء وهبي فيلمها الاباحي[99] هيفاء وهبي فيلمها الاباحي[100] هيفاء وهبي فيلمها الاباحي[101] هيفاء وهبي فيلمها الاباحي[102] هيفاء وهبي فيلمها الاباحي[103] هيفاء وهبي فيلمها الاباحي[104] هيفاء وهبي فيلمها الاباحي[105] هيفاء وهبي فيلمها الاباحي[106] Links: -- [1] http://bit.ly/cWhJJk [2] http://bit.ly/cWhJJk [3] http://bit.ly/cWhJJk [4] http://bit.ly/cWhJJk [5] http://bit.ly/cWhJJk [6] http://bit.ly/cWhJJk [7] http://bit.ly/cWhJJk [8] http://bit.ly/cWhJJk [9] http://bit.ly/cWhJJk [10] http://bit.ly/cWhJJk [11] http://bit.ly/cWhJJk [12] http://bit.ly/cWhJJk [13] http://bit.ly/cWhJJk [14] http://bit.ly/cWhJJk [15] http://bit.ly/cWhJJk [16] http://bit.ly/cWhJJk [17] http://bit.ly/cWhJJk [18] http://bit.ly/cWhJJk [19] http://bit.ly/cWhJJk [20] http://bit.ly/cWhJJk [21] http://bit.ly/cWhJJk [22] http://bit.ly/cWhJJk [23] http://bit.ly/cWhJJk [24] http://bit.ly/cWhJJk [25] http://bit.ly/cWhJJk [26] http://bit.ly/cWhJJk [27] http://bit.ly/cWhJJk [28] http://bit.ly/cWhJJk [29] http://bit.ly/cWhJJk [30] http://bit.ly/cWhJJk [31] http://bit.ly/cWhJJk [32] http://bit.ly/cWhJJk [33] http://bit.ly/cWhJJk [34] http://bit.ly/cWhJJk [35] http://bit.ly/cWhJJk [36] http://bit.ly/cWhJJk [37] http://bit.ly/cWhJJk [38] http://bit.ly/cWhJJk [39] http://bit.ly/cWhJJk [40] http://bit.ly/cWhJJk [41] http://bit.ly/cWhJJk [42] http://bit.ly/cWhJJk [43] http://bit.ly/cWhJJk [44] http://bit.ly/cWhJJk [45] http://bit.ly/cWhJJk [46] http://bit.ly/cWhJJk [47] http://bit.ly/cWhJJk [48] http://bit.ly/cWhJJk [49] http://bit.ly/cWhJJk [50] http://bit.ly/cWhJJk [51] http://bit.ly/cWhJJk [52] http://bit.ly/cWhJJk [53] http://bit.ly/cWhJJk [54] http://bit.ly/cWhJJk [55] http://bit.ly/cWhJJk [56] http://bit.ly/cWhJJk [57] http://bit.ly/cWhJJk [58] http://bit.ly/cWhJJk [59] http://bit.ly/cWhJJk [60] http://bit.ly/cWhJJk [61] http://bit.ly/cWhJJk [62] http://bit.ly/cWhJJk [63] http://bit.ly/cWhJJk [64] http://bit.ly/cWhJJk [65] http://bit.ly/cWhJJk
Re: [algogeeks] Yahoo
yeah 1:1 On Sun, Jul 4, 2010 at 4:57 PM, Amit Jaspal amitjaspal...@gmail.com wrote: it will be 1:1 On Sun, Jul 4, 2010 at 4:50 PM, Jitendra Kushwaha jitendra.th...@gmail.com wrote: it will be half... On Sun, Jul 4, 2010 at 4:18 PM, Piyush Verma 114piy...@gmail.com wrote: In a village in each family they give birth to children till they get a boy. IF girl child they try again. What is the ratio of boys to girls. -- 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.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Jitendra Kushwaha MNNIT, Allahabad -- 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.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] google
a linked list with pointer to the head and tail stored containing each request response tuple, and the pointers to the tuple stored in a hashtable described below. a hash table of size n containing the hash of the request identifier as the hashfunction, and the pointer to the element in the linked list as key. assumption: from the reqest/response, the data which identifis a request to be same is extractable in O(1). so when u add an element u just add it to the tail, calculate its hash insert it to the table and remove the element at the head from the linked list and its entry from the hashtable. the ad has to be done with a lock on both the data structures. collition in the hashtable cud be taken care by some perfect hashing scheme. guys pour in ur comments. On Sat, Jul 3, 2010 at 11:20 PM, sharad kumar sharad20073...@gmail.comwrote: @harit can u pl elaborate how we can do c part of ques by hashing in o(1) 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. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Topo. There are days when solitude is a heady wine that intoxicates you with freedom, others when it is a bitter tonic, and still others when it is a poison that makes you beat your head against the wall. ~Colette -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] oops
1)void foo(A a){} A* a =new A(); foo(*a); A b=*a; b=*a; How many copy ctors of class A are called? 2)When C++ compiler can't generate default = operator for the class? 3)what all errors is possible if u write past the array bounds -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Download Full Movies Hot Type +18
Download Full Movies Hot Type +18 http://bit.ly/cWhJJk -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Download Full Movies Hot Type +18
somebody kick this guy out!! Anil On Sun, Jul 4, 2010 at 9:48 PM, mai...@jadidnet.net wrote: Download Full Movies Hot Type +18 http://bit.ly/cWhJJk -- 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.comalgogeeks%2bunsubscr...@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 algoge...@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] Yahoo
it will be 1:1 because probability of guy is 1/2+1/2*1/2+1/2*1/2*1/2.=1 and girls and boys has same probability On Sun, Jul 4, 2010 at 6:00 AM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote: yeah 1:1 On Sun, Jul 4, 2010 at 4:57 PM, Amit Jaspal amitjaspal...@gmail.comwrote: it will be 1:1 On Sun, Jul 4, 2010 at 4:50 PM, Jitendra Kushwaha jitendra.th...@gmail.com wrote: it will be half... On Sun, Jul 4, 2010 at 4:18 PM, Piyush Verma 114piy...@gmail.comwrote: In a village in each family they give birth to children till they get a boy. IF girl child they try again. What is the ratio of boys to girls. -- 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.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Jitendra Kushwaha MNNIT, Allahabad -- 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.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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.comalgogeeks%2bunsubscr...@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 algoge...@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] C declaration
In c , it is necessary to declare all variables at the beginning of the program. But surprisingly we can declare a variable anywhere within the code using gcc compiler. Can anyone explain me the reason for this strange behavior ?? -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: numbers
On Jul 4, 6:31 am, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote: There is very long array of ints, and you are given pointer to base addr of this array.. each int is 16bit representation... you need to return the pointer to tht bit inside array where longest sequence of 1s start for example. if your array has following in bit representation: ,0111,0011,1110,,10111 then your longest sequence has 5 ones but the longest number has only 4 ones.(so finding highest num wnt wrk) -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD You can just define a function that accesses the array by bit index and then scan in a simple manner to find the longest stretch of 1's. I'll assume unsigned short is 16 bits. This code is not compiled or tested. // Exact definition here depends on how you want to index bits. // This is only one possibility. int bitval(unsigned short *a, unsigned long i) { return (a[i / 16ul] (i % 16 ul)) 1; } // Return index of start of longest span of 1's. // The special value NULLBITINDEX is returned if a is all 0's. // Here's one possibility. Make this 64 bits if bit arrays can be very large. typedef unsigned long BITINDEX; #define NULLBITINDEX (~0ul) BITINDEX longest1span(unsigned short *a, int size) { BITINDEX bitsize = size * 16, i, j; // Location and length of longest span found so far. BITINDEX r = NULLBITINDEX, len = 0; i = 0; while (1) { // Find start of a span of 1's. while(1) { if (i == bitsize) return r; if (bitval(a, i) == 1) break; i++; } // i now points to the start of a span of 1's. // Get index of next 0 in j. for (j = i + 1; j bitsize; j++) { if (bitval(a, j) == 0) break; } // [i..j-1] is a new span of 1's // update longest span info if (j - i len) { r = i; len = j - i; } // set preconditions for new span search i = j; } } -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: impossible microsoft puzzle
Hello All, Since duplicates are allowed, the fact that I can see the number on others hat is of no significance to me. My guess with this information is as good without it. Hence, I will consider the situation as: I am sitting alone in a dark room and I am given a hat with a number from 1 to N. I have to guess the number on my hat. I am in such a situation N times and I have to develop a strategy for guessing such that I am correct atleast once. Now if I guess a number x (1=x=N), my probability of correctness is 1/N i.e if I guess the same number N times, I will be correct once. Hence I guess the same number every time. For the given puzzle, all men guess the same number and at least one of them will be correct. :) Nikhil Jindal Department of Computer Engineering Delhi College of Engineering http://www.dce.edu, Delhi My Blog: http://fundoonick.blogspot.com My LinkedIn Profile: http://www.linkedin.com/in/nikhiljindal http://www.linkedin.com/in/nikhiljindal On Sun, Jul 4, 2010 at 11:05 PM, Dave dave_and_da...@juno.com wrote: But everyone guesses simultaneously. I take it to mean that no one knows anyone else's guess when making his own. Dave On Jul 4, 2:01 am, agnibha nath agni.fl...@gmail.com wrote: can it be like... one person sees any other person's number and guesses it first. then, everybody else guesses the same number. this way, atleast one guesses it right, since there is no boundation on the no. of wrong guesses. On Jul 3, 11:10 pm, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote: N people team up and decide on a strategy for playing this game. Then they walk into a room. On entry to the room, each person is given a hat on which one of the first N natural numbers is written. There may be duplicate hat numbers. For example, for N=3, the 3 team members may get hats labeled 2, 1, 2. Each person can see the numbers written on the others' hats, but does not know the number written on his own hat. Every person then simultaneously guesses the number of his own hat. What strategy can the team follow to make sure that at least one person on the team guesses his hat number correctly? -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD- Hide quoted text - - Show quoted text - -- 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.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. Please access the attached hyperlink for an important electronic communications disclaimer: http://dce.edu/web/Sections/Standalone/Email_Disclaimer.php -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] oops contd
1)in singleton class how will u delete the obj ? 2)what happens if I throw exception from destructor. can I throw exception from construtor and destructor ? -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] shift operators
how do we perform left shift and right shift on negative numbers.. for eg -13 -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] sum of subsequence
find the subsequence in an array which sum to k -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] 0 and 1 again :)
Hello Jalaj, I am not sure whether I have understood your approach corectly, but do you want to say that you will always get a subsequence with number of terms equal to twice the min(count0, count1)? Consider for ex: 00 The longest subsequence is 01 or 10, both of length 2(and none of length 4). PS: I am assuming by maximum subsequence, you meant longest. Nikhil Jindal On Sun, Jul 4, 2010 at 3:21 PM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote: You are given an array ' containing 0s and 1s. Find O(n) time and O(1) space algorithm to find the maximum sub sequence which has equal number of 1s and 0s. Examples 1) 10101010 The longest sub sequence that satisfies the problem is the input itself 2)1101000 The longest sub sequence that satisfies the problem is 110100 My approach: in 1 go count the number of zero's and 1's .. find which is smaller then in the next scan take two count1 and count0 and start fetching o's and 1's upto you get them to the smaller count(calculated earlier) better answers ?? -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. Please access the attached hyperlink for an important electronic communications disclaimer: http://dce.edu/web/Sections/Standalone/Email_Disclaimer.php -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: C declaration
On Jul 4, 2:38 pm, Faadu alokchat...@gmail.com wrote: In c , it is necessary to declare all variables at the beginning of the program. But surprisingly we can declare a variable anywhere within the code using gcc compiler. Can anyone explain me the reason for this strange behavior ?? C99 and C++ both allow declarations to be mixed with code. Gcc allows mixed declarations as an extension in C90 mode as well. If you say gcc -pedantic file.c, you'll get a warning error about this. -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: number of 1's
the looping algo in the worst case can be o(n) whereas the anding with 0x555 and so on is a log n algo :) Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Sun, Jul 4, 2010 at 10:21 AM, shrinivas yadav shri.nit...@gmail.comwrote: it is easy int count =0; take input in num while(num) { num=num(num-1); count ++; } printf(%d,count); On 7/3/10, Dheeraj Jain dheerajj...@gmail.com wrote: http://geeksforgeeks.org/?p=1176 On Sat, Jul 3, 2010 at 9:17 PM, Dave dave_and_da...@juno.com wrote: Assuming that x is a 32 bit integer: n = ((x 1) 0x) + (x 0x) n = ((n 2) 0x) + (n % 0x) n = ((n 4) 0x0F0F0F0F) + (n 0x0F0F0F0F) n = ((n 8) 0x00FF00FF) + (n 0x00FF00FF) n = ((n 16) 0x) + (n 0x) n now is the number of bits set in x. Dave On Jul 3, 11:27 am, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote: is there any better way of finding number of 1's in binary of a number other then below: #includestdio.h #includestdlib.h int main(){ int n; printf(enter numb\n); scanf(%d,n); int i=1; int count=0; for(int j=0;j31;j++){ if(n(ij)){ count++; } } printf(%d,count); system(pause); return 0; } -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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.comalgogeeks%2bunsubscr...@googlegroups.com algogeeks%2bunsubscr...@googlegroups.comalgogeeks%252bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With regard, Shrinivas mca,NIT DURGAPUR - If you wanna succeed, you will find a way - else - you will find an excuse -- 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.comalgogeeks%2bunsubscr...@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 algoge...@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: impossible microsoft puzzle
If all the men gusses the same number then the solution could be wrong. for example the the value of N is 5 and numbers given are 1,2,1,1,1 and everybody guesses 4 then the solution is wrong. A different solution is like - All men will stand in a row and and everybody can think of his hat number as his position in row. In this way atleast one person will be there who is correct. Manoj Janoti On Mon, Jul 5, 2010 at 3:19 AM, Nikhil Jindal fundoon...@yahoo.co.inwrote: Hello All, Since duplicates are allowed, the fact that I can see the number on others hat is of no significance to me. My guess with this information is as good without it. Hence, I will consider the situation as: I am sitting alone in a dark room and I am given a hat with a number from 1 to N. I have to guess the number on my hat. I am in such a situation N times and I have to develop a strategy for guessing such that I am correct atleast once. Now if I guess a number x (1=x=N), my probability of correctness is 1/N i.e if I guess the same number N times, I will be correct once. Hence I guess the same number every time. For the given puzzle, all men guess the same number and at least one of them will be correct. :) Nikhil Jindal Department of Computer Engineering Delhi College of Engineering http://www.dce.edu, Delhi My Blog: http://fundoonick.blogspot.com My LinkedIn Profile: http://www.linkedin.com/in/nikhiljindal http://www.linkedin.com/in/nikhiljindal On Sun, Jul 4, 2010 at 11:05 PM, Dave dave_and_da...@juno.com wrote: But everyone guesses simultaneously. I take it to mean that no one knows anyone else's guess when making his own. Dave On Jul 4, 2:01 am, agnibha nath agni.fl...@gmail.com wrote: can it be like... one person sees any other person's number and guesses it first. then, everybody else guesses the same number. this way, atleast one guesses it right, since there is no boundation on the no. of wrong guesses. On Jul 3, 11:10 pm, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote: N people team up and decide on a strategy for playing this game. Then they walk into a room. On entry to the room, each person is given a hat on which one of the first N natural numbers is written. There may be duplicate hat numbers. For example, for N=3, the 3 team members may get hats labeled 2, 1, 2. Each person can see the numbers written on the others' hats, but does not know the number written on his own hat. Every person then simultaneously guesses the number of his own hat. What strategy can the team follow to make sure that at least one person on the team guesses his hat number correctly? -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD- Hide quoted text - - Show quoted text - -- 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.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. Please access the attached hyperlink for an important electronic communications disclaimer: http://dce.edu/web/Sections/Standalone/Email_Disclaimer.php -- 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 algogeeks%2bunsubscr...@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 algoge...@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: C declaration
this type of error is prominent in turbo c compilers.. but above mentioned c99,gcc and many other allow mixing of declarations.. -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: number of 1's
@ashish : you are correct but the number of bits in the integer datatype is fixed while using anding algo.. but the looping algorithm is valid for any number of bit in the integer.. -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] graphs again
i would prepare the transitivity matrix while inserting the edge into the matrix the search then would be a O(1) Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Sun, Jul 4, 2010 at 3:15 PM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote: A graph is given. You need to design a data structure with minimum space complexity such that it does the follows -- Finds whether nodes u and v have a path in between them in O(1) time. -- Finds whether there is a path of length k between u and v in O(k) time. The same data structure to be used for both the purposes. -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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.comalgogeeks%2bunsubscr...@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 algoge...@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: number of 1's
in general, preprocessing is preferred over run time calculation hence i would have he number of bits on a platform known/calculated upfront and then use the log n algo Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Mon, Jul 5, 2010 at 9:16 AM, Rahul Kushwaha rahul.kushw...@gmail.comwrote: @ashish : you are correct but the number of bits in the integer datatype is fixed while using anding algo.. but the looping algorithm is valid for any number of bit in the integer.. -- 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.comalgogeeks%2bunsubscr...@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 algoge...@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] shift operators
On Sun, Jul 4, 2010 at 9:07 PM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote: how do we perform left shift and right shift on negative numbers.. for eg -13 if negative number is shifted left () then vacent space is filled by 0's and right sift () then vacents space is filled by sign bits ex: -4 binary== 1 100 -42 after left shift 1 1 -16 -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] cops n robber
yes if one having speed greater than other then at some point of time he will catch the robber -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] shift operators
bitwise are ony applicable to unsignedtheir behaviour is undefined on negative numbers... -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] amazon question
in my approach a( b,c)- this implies that nodes within parenthesis are child of a where b is left child and c is right child if there is no left child then we can use a(,c) and if there is no right child then use a(b) and if there is no child use only a -- 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] oops
For the first question answer is 2 copy constructors are called. One when you call foo(*a) and the other when you are assigning object b to *a On Sun, Jul 4, 2010 at 8:49 PM, sharad sharad20073...@gmail.com wrote: 1)void foo(A a){} A* a =new A(); foo(*a); A b=*a; b=*a; How many copy ctors of class A are called? 2)When C++ compiler can't generate default = operator for the class? 3)what all errors is possible if u write past the array bounds -- 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.comalgogeeks%2bunsubscr...@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 algoge...@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.