Re: [algogeeks] substring in big string
the size of the substring is an important factor~~ if the substring is only a character, it is easy. if the substring is 2 characters than the big string , it is easy too~~ am i right? :-) 2012/10/18 Ashish Goel ashg...@gmail.com there is a big string which needs 2GB memory to fit in but you have only 100mb. Find a substring in the big string. Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 -- 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. -- chenwujin @seu -- 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] what will be the focus of yahoo in written exam ,what to study for it. please respond ASAP..
two month ago , I passed yahoo written test in china. data structure, algorithm , and given a code segment with some lines missing, ask you to fill it. today i rejected yahoo offically. actually i love to be one of yahoo. finally i chose microstrategy in hangzhou ,china, because it is close to my home. good luck~! 2011/11/10 rahul sharma rahul23111...@gmail.com i also want to knw...somebody who has faced yahoo this year plz post. On Wed, Nov 9, 2011 at 11:50 PM, kumar raja rajkumar.cs...@gmail.comwrote: -- Regards Kumar Raja M.Tech(SIT) IIT Kharagpur, 10it60...@iitkgp.ac.in -- 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. -- 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] i cannot solve this written test question
Given a positive number N, find a minimum number M greater than N, M has the same length with N and the sum of the bits are equal. example: N=134 , M=143, // 1+3+4=1+4+3 N=020, M = 101, //2=1+1 the length of N is less than 1000. -- 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] i cannot solve this written test question
@Ankur , as example: N=134 , M=143, // 1+3+4=1+4+3 N=020, M = 101, //2=1+1 I mean the sum of digits. 2011/10/9 Ankur Garg ankurga...@gmail.com Is it sum of bits or sum of digits ? On Sun, Oct 9, 2011 at 1:39 PM, wujin chen wujinchen...@gmail.com wrote: Given a positive number N, find a minimum number M greater than N, M has the same length with N and the sum of the bits are equal. example: N=134 , M=143, // 1+3+4=1+4+3 N=020, M = 101, //2=1+1 the length of N is less than 1000. -- 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. -- 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] i cannot solve this written test question
@Aamir , yes, for some N, it will be no ans, then return -1. 2011/10/9 Aamir Khan ak4u2...@gmail.com Answer won't be possible in for each N. What would be answer for N=999 ? On Sun, Oct 9, 2011 at 4:22 PM, Ankur Garg ankurga...@gmail.com wrote: Is it sum of bits or sum of digits ? On Sun, Oct 9, 2011 at 1:39 PM, wujin chen wujinchen...@gmail.comwrote: Given a positive number N, find a minimum number M greater than N, M has the same length with N and the sum of the bits are equal. example: N=134 , M=143, // 1+3+4=1+4+3 N=020, M = 101, //2=1+1 the length of N is less than 1000. -- 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. -- Aamir Khan | 3rd Year | Computer Science Engineering | IIT Roorkee -- 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: i cannot solve this written test question
@Navneet, i mean the length of N is less than 1000, not the value of N . *so, N maybe cannot be represented in 32bit . 10^1000-1 is huge number~~ * 2011/10/9 Navneet navneetn...@gmail.com sumOfDigits(i) - simply sums all the digits and returns the value. sortDigits() - takes a number and return the lowest possible number possible with digits of param passed. flag = false; for(int i=n+1, i 1000; i++) //mention to go upto 1000 in problem { if(sumOfDigits(i) == sumOfDigits(n)) { //a candidate int sorted i = sortDigits(i); int sorted n = sortDigits(n); if(i == n) { //we found one cout\nDesired number is iendl; //may abort or continue to find more flag = true; } } if(!flag) cout\nNo such number foundendl; } On Oct 9, 5:04 pm, wujin chen wujinchen...@gmail.com wrote: @Aamir , yes, for some N, it will be no ans, then return -1. 2011/10/9 Aamir Khan ak4u2...@gmail.com Answer won't be possible in for each N. What would be answer for N=999 ? On Sun, Oct 9, 2011 at 4:22 PM, Ankur Garg ankurga...@gmail.com wrote: Is it sum of bits or sum of digits ? On Sun, Oct 9, 2011 at 1:39 PM, wujin chen wujinchen...@gmail.com wrote: Given a positive number N, find a minimum number M greater than N, M has the same length with N and the sum of the bits are equal. example: N=134 , M=143, // 1+3+4=1+4+3 N=020, M = 101, //2=1+1 the length of N is less than 1000. -- 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. -- Aamir Khan | 3rd Year | Computer Science Engineering | IIT Roorkee -- 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. -- 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] advice about yahoo needed!
hi all, i will graduate in 2012/5 as a master, and now i am hunting a job. last week, i got an oral offer from yahoo global RD center in beijing, ( http://beijing.yahoo.com/en/), the formal offer will arrive at the end of october. does anyone know something about it? i mean the develop trend, package, technology etc. i think yahoo is declining these years and i am wondering whether it is a good choice. thanks in advance~! -- 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: c output,printf(%llx)
@Dave printf(a=%x, b=%llx,a,b,c); i think c will be ignored~~ , and the output is a=9,b=10 2011/9/19 Dave dave_and_da...@juno.com @Wujin: What do you expect the output to be? How does it differ from what you actually get? Dave On Sep 18, 8:47 am, wujin chen wujinchen...@gmail.com wrote: usigned long long x = 0x12345678; int a = 0x09; int b = 0x10; printf(a=%x, b=%llx,a,b,c); the result is: a=9,b=123456780010 i wonder why~~ can anyone explain it? thanks. -- 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] c output,printf(%llx)
usigned long long x = 0x12345678; int a = 0x09; int b = 0x10; printf(a=%x, b=%llx,a,b,c); the result is: a=9,b=123456780010 i wonder why~~ can anyone explain it? thanks. -- 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] c output,printf(%llx)
sorry , it should be : usigned long long c = 0x12345678; int a = 0x09; int b = 0x10; printf(a=%x, b=%llx,a,b,c); 2011/9/19 sagar pareek sagarpar...@gmail.com Check out what u have written... On Sun, Sep 18, 2011 at 7:17 PM, wujin chen wujinchen...@gmail.comwrote: usigned long long x = 0x12345678; int a = 0x09; int b = 0x10; printf(a=%x, b=%llx,a,b,c); the result is: a=9,b=123456780010 i wonder why~~ can anyone explain it? thanks. -- 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. -- **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. -- 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] problems about the puzzle Chameleon
hi all, i encountered this puzzle (http://www.crackpuzzles.com/?p=236): At one point, a remote island’s population of chameleons was divided as follows: - 13 red chameleons - 15 green chameleons - 17 blue chameleons Each time two different colored chameleons would meet, they would change their color to the third one. (i.e.. If green meets red, they both change their color to blue.) Is it ever possible for all chameleons to become the same color? Why or why not?” and the solution provided by auther is like this: *Solution: * Lets define a function f(red, blue, green) = |red – blue| + |blue – green| + |green – red| When two chameleons of different colours meet and convert to the third one, the value of function f will always change by 0 or 3 or 6 (i.e. a multiple of 3). In the initial situation f is 8. If all of them get converted into a single colour then f would be 90 = 2*(red+blue+green) So we are basically looking for a solution to the equation: 8 + 3x = 90, which has no integer solutions. Hence it is not possible. well, my problem is this: f(13,15,17)=8, f(15,14,16)=2 so , we can see that ” the value of function f will always change by 0 or 3 or 6″ is not true, i am wondering~! -- 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: problems about the puzzle Chameleon
hi Don, i think f(15,14,16) =|15-14|+|14-16|+|16-15| = 1+2+1=4, hou do you get f(15,14,16) = 5? 2011/9/6 Don dondod...@gmail.com No, f(15,14,16) = 5. Don On Sep 5, 8:33 pm, wujin chen wujinchen...@gmail.com wrote: hi all, i encountered this puzzle (http://www.crackpuzzles.com/?p=236): At one point, a remote island's population of chameleons was divided as follows: - 13 red chameleons - 15 green chameleons - 17 blue chameleons Each time two different colored chameleons would meet, they would change their color to the third one. (i.e.. If green meets red, they both change their color to blue.) Is it ever possible for all chameleons to become the same color? Why or why not? and the solution provided by auther is like this: *Solution: * Lets define a function f(red, blue, green) = |red - blue| + |blue - green| + |green - red| When two chameleons of different colours meet and convert to the third one, the value of function f will always change by 0 or 3 or 6 (i.e. a multiple of 3). In the initial situation f is 8. If all of them get converted into a single colour then f would be 90 = 2*(red+blue+green) So we are basically looking for a solution to the equation: 8 + 3x = 90, which has no integer solutions. Hence it is not possible. well, my problem is this: f(13,15,17)=8, f(15,14,16)=2 so , we can see that the value of function f will always change by 0 or 3 or 6″ is not true, i am wondering~! -- 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] subarray wid sum=k
agree with hemank ! 2011/9/2 hemank lamba hemankla...@gmail.com Are you sure it is not continuous subsets. Because otherwise i guess it is a NP problem. On Fri, Sep 2, 2011 at 7:58 AM, manish kapur manishkapur.n...@gmail.comwrote: given an unsorted array of +ve and -ve elements.find a subarray with sum= k in O(n). you can use some extra space -- 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. -- 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] maximum XOR
refer to this : http://discuss.joelonsoftware.com/default.asp?interview.11.614716 2011/8/27 jai gupta sayhelloto...@gmail.com @Neha take 42, 21 and 1 42 ^ 1 =43 while 42 ^21 =63 On Fri, Aug 26, 2011 at 10:28 PM, Neha Singh neha.ndelhi.1...@gmail.comwrote: Sort the nos., which can be done in O(nlogn) Now the 1st and the last integers are the required integers. -- 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. -- Jai Prakash Gupta Third Year Undergraduate Computer Science and Engineering Department IIT Kharagpur -- 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] array sum
take a subset from the array, if the average is equal then output the result. backtracing can do this. the time complexity seems not low, any good idea~~? 2011/8/27 sukhmeet singh sukhmeet2...@gmail.com how to divide an integer array into 2 sub-arrays and make their averages equal? array is unsorted and we can also take any numbers and the numbers in the array need not be contiguous in the original array. how many total such array's are possible. Output them -- 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] array question
i think XOR operator should be used to solve question. Given the integers in the array A: n1,n2...nk, we can do this recursively: XOR all the integers in A, assume the result is F = n1^n2^...^nk, F must not be 0. for i-th bit in F from rightmost to left most: if the i-th bit is 1, halve A into 2 parts: A1 and A2, that elements in A1 hold 1 in the i-th bit and A2 hold 0 in the i-th bit if XOR(A1) == 0 A1 is the result if XOR(A2) == 0 A2 is the result if the result has not been got, we will use the next non-zero bit in F to halve A1 and A2 excepte the first pass,we can do some optimization so that there is no need to compute the F with XOR one by one. we can compute F when halve the array. but in this way , the time complexity may be not linear if the question is like this: Given an array of integers. Each number in the array repeats 3 number of times, but only 1 number repeated for 2 number of times. Find that number. it can be solved in O(n), because we can use the number to eliminate some parts. 2011/8/16 Raghavan its...@gmail.com - Sort the array - o(log n) based on the sorting strategy might be radix sort - check the numbers count have a counter o(1) space and again o(n) time - changing from one number to other check counter%2 == 0 if so then we get answer So consolidated time would be o(n) and space is o(1); On Tue, Aug 16, 2011 at 3:20 PM, MAC macatad...@gmail.com wrote: The question needed o(1) space and o(n) time ... o(n) map approach is obviously fine but space is taken up ... On Tue, Aug 16, 2011 at 2:38 PM, Raghavan its...@gmail.com wrote: @sukran: If you were asking for the map based solution space and time complexity would be o(n). On Tue, Aug 16, 2011 at 2:34 PM, sukran dhawan sukrandha...@gmail.comwrote: what is the complexity in which it has been done ? On Tue, Aug 16, 2011 at 1:41 PM, MAC macatad...@gmail.com wrote: Given an array of integers. Each number in the array repeats ODD number of times, but only 1 number repeated for EVEN number of times. Find that number. -- thanks --mac -- 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. -- Thanks and Regards, Raghavan KL -- 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. -- thanks --mac -- 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. -- Thanks and Regards, Raghavan KL -- 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] how to estimate opponent's web page warehouse size?
you are an engineer of a search engineering company, such as google. every search engineering company has a web page warehouse which contains large numbers of web pages. and now you have a task, given two search engineerings, say google and yahoo, estimate yahoo's size of web page warehouse. you can search any words to get statistics. -- 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] MS interview question
how about this one? Node* reverseBy2(Node* head){ Node* p1 = head; if(p1 == NULL) return NULL; Node* p2 = p1-next; if(p2 == NULL) return head; Node* nextHead = p2-next; p2-next = p1; p1-next = reverseBy2(nextHead); return p2; } [?] 2011/6/1 Shivaji Varma shivaji...@gmail.com Hi, Please take a look at this link. http://mycsinterviewsexperiences.blogspot.com/ -- Shivaji On Wed, Jun 1, 2011 at 6:26 AM, Anand anandut2...@gmail.com wrote: Given a linked list of the form, 1-2-3-4-5-6, convert it into the form 2-1-4-3-6-5. Note that the nodes need to be altered and not the data contained in them -- 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. -- 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. 1E3.gif
Re: [algogeeks] Google Interview Question
@Piyush, how to deal with this case :100 , 10 2011/5/27 Piyush Sinha ecstasy.piy...@gmail.com we can work out if we sort according to the leftmost integer On 5/27/11, adityasir...@gmail.com adityasir...@gmail.com wrote: are you kidding me. Just simple sort wont work. On Fri, May 27, 2011 at 9:31 AM, radha krishnan radhakrishnance...@gmail.com wrote: sort :) On Fri, May 27, 2011 at 6:57 PM, ross jagadish1...@gmail.com wrote: Hi all, Given an array of elements find the largest possible number that can be formed by using the elements of the array. eg: 10 9 ans: 910 2 3 5 78 ans: 78532 100 9 ans: 9100 -- 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. -- 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- 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] how to find a smallest prime bigger than a given number
given a number n, compute the smallest prime that is bigger than n. for example, n=8, then the smallest prime that bigger than 8 is 11. i wonder whether there is an effective way, rather than check every number bigger than n one by one. thanks. -- 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: how to find a smallest prime bigger than a given number
@Dave, thanks for your reply. i know that, i can only check from 6*n - 1 and 6*n + 1.. assume that, n=1 , and we begin from k=1667, the number needed to check is 10001,10003 but to determin 10001 is prime or not costs a lot, right? when the n is huge, it will be not feasible. is there some math principle to solve this problem easily? 2011/5/18 Dave dave_and_da...@juno.com @Wujin: Well, obviously, you don't have to check _every_ number one-by- one. If n 1, you can ignore every even number. Furthermore, if n 3, you can ignore every odd multiple of 3. That means that you need to check only numbers of the form 6*n - 1 and 6*n + 1. Dave On May 17, 9:09 pm, wujin chen wujinchen...@gmail.com wrote: given a number n, compute the smallest prime that is bigger than n. for example, n=8, then the smallest prime that bigger than 8 is 11. i wonder whether there is an effective way, rather than check every number bigger than n one by one. thanks. -- 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.