[algogeeks] Finding subarray
set of integers in an array X that the sum equals a given number N Eg. X = {-1, -3, 5, 13, 2, 24, 9, 3, 3} Lets say the number 5 which can be formed in the following manner 5= 2 + 3 (the values from array). If there is no match it has to return invalid numbers. We also have to see the complexity of the solution. I thought of one approach but not sure if there is more approach where the complexity will be minimal. Lets say sort the array and now take number and find the closest number for that. Then in a recursion manner search for another( Lets say number '5', it search the list and found closest match will be 3. Then recursively search for 3 now where closest match is 2) Any algo with better complexity will be appreciated. *Subhransu Panigrahi * *Email:* subhransu.panigr...@gmail.com -- 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] Finding subarray
I'd try a tabular approach. Check dynamic programming. Samples like LCS may give you a click. On Tue, Mar 29, 2011 at 11:46 PM, Subhransu subhransu.panigr...@gmail.com wrote: set of integers in an array X that the sum equals a given number N Eg. X = {-1, -3, 5, 13, 2, 24, 9, 3, 3} Lets say the number 5 which can be formed in the following manner 5= 2 + 3 (the values from array). If there is no match it has to return invalid numbers. We also have to see the complexity of the solution. I thought of one approach but not sure if there is more approach where the complexity will be minimal. Lets say sort the array and now take number and find the closest number for that. Then in a recursion manner search for another( Lets say number '5', it search the list and found closest match will be 3. Then recursively search for 3 now where closest match is 2) Any algo with better complexity will be appreciated. Subhransu Panigrahi Email: subhransu.panigr...@gmail.com -- 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. -- Cheers, hammett http://hammett.castleproject.org/ -- 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] maximum difference in an array
Problem Can anyone give me the efficient algo to know the the maximum difference of two numbers in an arrayplease only tell the algo not code - *UTKARSH SRIVATAV* *CSE-3 B-Tech 2nd Year @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 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] Finding subarray
@ Subhranshu : Your approach will fail for a case let X = {-1,4,2,3} and your sum is 5. You will get nearest element 4, but there is no 1 in the set. A DP solution will be like this : Let a[i][j] be the 1 if using the first i elements we can get sum of j, and 0 otherwise. Initialise a[0][j] = 0, a[i][0] = 1; Now a[i][j] = a[i-1][j] | a[i-1][ j - X[i] ], where X[i] is ith element of set X. On Wed, Mar 30, 2011 at 12:35 PM, hammett hamm...@gmail.com wrote: I'd try a tabular approach. Check dynamic programming. Samples like LCS may give you a click. On Tue, Mar 29, 2011 at 11:46 PM, Subhransu subhransu.panigr...@gmail.com wrote: set of integers in an array X that the sum equals a given number N Eg. X = {-1, -3, 5, 13, 2, 24, 9, 3, 3} Lets say the number 5 which can be formed in the following manner 5= 2 + 3 (the values from array). If there is no match it has to return invalid numbers. We also have to see the complexity of the solution. I thought of one approach but not sure if there is more approach where the complexity will be minimal. Lets say sort the array and now take number and find the closest number for that. Then in a recursion manner search for another( Lets say number '5', it search the list and found closest match will be 3. Then recursively search for 3 now where closest match is 2) Any algo with better complexity will be appreciated. Subhransu Panigrahi Email: subhransu.panigr...@gmail.com -- 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. -- Cheers, hammett http://hammett.castleproject.org/ -- 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] Finding subarray
For this X = {-1,4,2,3} Nearest will be 4 then remain is 1 but the there is no 1 so again in recursion nearest number is 2 then it search for suitable number where the sum is zero so 3 is not suitable then it will pick the next closest number to 2 which is one and make it (5= 4 + 2 -1 ) I just propose one approach you guys also can think a better one. *Subhransu Panigrahi * *Mobile:* *+91-9840931538* *Email:* subhransu.panigr...@gmail.com On Wed, Mar 30, 2011 at 12:55 PM, Saikat Debnath crazysai...@gmail.comwrote: @ Subhranshu : Your approach will fail for a case let X = {-1,4,2,3} and your sum is 5. You will get nearest element 4, but there is no 1 in the set. A DP solution will be like this : Let a[i][j] be the 1 if using the first i elements we can get sum of j, and 0 otherwise. Initialise a[0][j] = 0, a[i][0] = 1; Now a[i][j] = a[i-1][j] | a[i-1][ j - X[i] ], where X[i] is ith element of set X. On Wed, Mar 30, 2011 at 12:35 PM, hammett hamm...@gmail.com wrote: I'd try a tabular approach. Check dynamic programming. Samples like LCS may give you a click. On Tue, Mar 29, 2011 at 11:46 PM, Subhransu subhransu.panigr...@gmail.com wrote: set of integers in an array X that the sum equals a given number N Eg. X = {-1, -3, 5, 13, 2, 24, 9, 3, 3} Lets say the number 5 which can be formed in the following manner 5= 2 + 3 (the values from array). If there is no match it has to return invalid numbers. We also have to see the complexity of the solution. I thought of one approach but not sure if there is more approach where the complexity will be minimal. Lets say sort the array and now take number and find the closest number for that. Then in a recursion manner search for another( Lets say number '5', it search the list and found closest match will be 3. Then recursively search for 3 now where closest match is 2) Any algo with better complexity will be appreciated. Subhransu Panigrahi Email: subhransu.panigr...@gmail.com -- 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. -- Cheers, hammett http://hammett.castleproject.org/ -- 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 difference in an array
Don't you think sorting the array and take the first last element ! ! ! *Subhransu Panigrahi * *Mobile:* *+91-9840931538* *Email:* subhransu.panigr...@gmail.com On Wed, Mar 30, 2011 at 12:43 PM, UTKARSH SRIVASTAV usrivastav...@gmail.com wrote: Problem Can anyone give me the efficient algo to know the the maximum difference of two numbers in an arrayplease only tell the algo not code - *UTKARSH SRIVATAV* *CSE-3 B-Tech 2nd Year @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 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 difference in an array
Sorting takes O (N logN) .. You can find the minimum and the maximum in a single traversal i.e O(N) time and return the difference of the two .. To find minimum and maximum you can do the following : i) Assign min = max = first element in the array. ii)Then traverse the array .. for each element in the array .. if it is greater than max , update max = that element .. else if it is lesser than min, update min as that element .. After finding min and max return the difference of the two On Wed, Mar 30, 2011 at 12:43 PM, UTKARSH SRIVASTAV usrivastav...@gmail.com wrote: Problem Can anyone give me the efficient algo to know the the maximum difference of two numbers in an arrayplease only tell the algo not code - *UTKARSH SRIVATAV* *CSE-3 B-Tech 2nd Year @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 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] Are U a Student Must Read this Frwd This Please If u Like We R student like You TOO
NIT JAIPUR PRESENTS YOU KAMPUSATTACK.COM http://ampusattack.com/ Biggest Social Platform For Students by Students - Enjoy Spiced up Social Networking With Hot Features! - Get Connected To Constillation Of Young Brains Like You! - Access share useful collection of Ebooks,Notes, Ppt's,Codes,Programs. etc.. - Find Lot Of Humor Fun Inside! - Chat With Spicy Kampus Messenger with new people , Play Amazing Games. *! STAND OUT FROM CROWD !* With Our Useful Resources You Will Never Be Same As Rest Of Crowd - GD 's With Pro's Con's. - INTERVIEW preprations by personal experience of people. - PLACEMENT PAPERS - *College Previous Papers* - *Info About Latest **Technologies Gadgets.* - *Project Ideas help.* - *INTERNSHIP TRANING GUIDANCE.* *! BE CONNECTED AND UPDATED!* - *Connect With Your Pal's , Senior's Alumni's.* - *Exchange Idea's With People Across Kampuses.* *! EXCLUSIVE EXPERT ZONE !* - STEP OUT from other's with our *INDUSTRIAL GUINDANCE* from Adobe , Microsoft, NTPC, BPCL ,Accenture. - Field Experts Career Consultant Inside. Register Today! *WWW.KAMPUSATTACK.COM* http://www.kampusattack.com/ -- Arpit Bhatnagar (MNIT JAIPUR) -- 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] [brain teaser ] 30march
*Fishing Problem * * *Two fathers and two sons went for fishing. Each of them caught a fish, and none of them caught the same fish. However, they caught a total of only three fish. How is this possible? Update Your Answers at : Click Herehttp://dailybrainteaser.blogspot.com/2011/03/30march.html?lavesh=lavesh Solution: Will be updated after 1 day -- Never explain yourself. Your friends don’t need it and your enemies won’t believe it . -- 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] [brain teaser ] 30march
grandfather, father and son went for fishing... here we have two fathers and two sons On Wed, Mar 30, 2011 at 1:52 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *Fishing Problem * * *Two fathers and two sons went for fishing. Each of them caught a fish, and none of them caught the same fish. However, they caught a total of only three fish. How is this possible? Update Your Answers at : Click Herehttp://dailybrainteaser.blogspot.com/2011/03/30march.html?lavesh=lavesh Solution: Will be updated after 1 day -- Never explain yourself. Your friends don’t need it and your enemies won’t believe it . -- 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. -- thezeitgeistmovement.com -- 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: Google puzzles
Arpit The formula that you have written is wrong. You would have approached it correctly but the formula written here is incorrect. m= n + (n**1/6* + (n-1)) + ((n**7/6* + (n-1))**1/6* + n-2) +.. If you add all the terms there should be 1/6 in these terms as the terms give the number of medals given on each day. If you use 7/6, you only need to solve for one term where n-6 would come. As the terms in the series when 7/6 is used give the number of medals remaining at (n-i)th day. Sukhmeet, You have to apply the formula n = k - [(n-1) + (1/7)(k- (n-1))] where k is taken to be the number of medals at the start of (n-1)th day. on (n-1)th day, n-1 medals are given. Then (k - (n-1)) medals are left. 1/7 of these are given away as well. So after (n-1) days the medals left are given by RHS of the equation which is equal to n - the medals left which are given on nth day. Solving this equation we get: k - (n-1) = 7/6*n Thus, medals given away on (n-1)th day = (n-1) + (1/7)*(7/6*n) = (n-1) + 1/6*n Similarly medals given away on (n-2)th day = (n-2) + (1/7)*(7/6*(sum of medals given on (n-1)th and nth days)) = (n-2) + (1/7)*(7/6*(n-1 + 7/6*n)) = (n-2) + (1/6)*(n-1 + 1/6*n)) For (n-i)th day, medals given away = (n-i) + (1/6)*(sum of medals given away from (n- (i-1))th to nth day) It goes on like this till we get the term for first day. SO total medals, m = n + [(n-1) + 1/6*n] + [(n-2) + (1/6)*(n-1 + 7/6*n))] +... Put 6 in this equation and we get the required answer m = 36 Simple formula m = n + [(n-1) + 1/6*first term]+ [(n-2) + (1/6)*(sum of 1st and 2nd term)]+ + [(n-i) + (1/6)*(sum of all terms till now)] + i goes upto n -- 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: Construct Binary Tree From Ancestor Matrix
a[i][j]=1 if 'i' is a parent to 'j' But in your matrix, a[1][2] = 1 a[1][3] = 1 a[2][3] = 1 a[4][2] = 1 a[4][3] = 1 You have taken 'j' to be a parent to 'i' -- Tushar Bindal Computer Engineering Delhi College of Engineering Mob: +919818442705 E-Mail : tusharbin...@jugadengg.com -- 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] Stuck at UVa Online judge problem no. 825 (Walking on Safe Side)
Hey, I am getting WA for the problem Walking on Safe side for my code written below. I have checked all test cases and formatting of output and its working fine on my pc, could anyone help plz. Here is the problem link http://uva.onlinejudge.org/index.php?option=com_onlinejudgeItemid=8page=show_problemcategory=10problem=766mosmsg=Submission+received+with+ID+8692538 Here is my code #includeiostream #includecstdio #includecstring #includecstdlib using namespace std; int table[200][200]={}; char str[200]; int dx,dy; int ans=0; void cal(int x,int y) { if(x==dxy==dy) { ans++; return; } if(table[x][y+1]==0ydy) { cal(x,y+1); } if(table[x+1][y]==0xdx) { cal(x+1,y); } } void Reset() { int i, j; for(i = 0; i=dx; i++) { for(j = 0; j=dy; j++) { table[i][j] = 0; } } } void ReadCase() { int i, j; char *p; gets(str); cindxdy; Reset(); for(i = 0; i=dx; i++) { gets(str); p = strtok(str, ); p = strtok(NULL, ); while(p) { j = atoi(p); table[i-1][j-1] = 1; p = strtok(NULL, ); } } dx--; dy--; /*for(i=0;i=dx;i++) { for(j=0;j=dy;j++) { couttable[i][j] ; } cout\n; }*/ } int main() { int t; cint; while(t--) { ans=0; ReadCase(); cal(0,0); coutans; if(t!=0) cout\n\n\n; } } -- Regards Ravi Maggon -- 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] adult hot photosvideos
hot katrina kaif wallpapers http://cinyworld96.blogspot.com/2011/03/katrina-kaif.html deepika padukone new stills http://cinyworld96.blogspot.com/2011/03/deepika-padukone.html beautiful aishwariya rai http://cinyworld96.blogspot.com/2011/03/aishwariya-rai.html diya mirza sexy photos http://cinyworld96.blogspot.com/2011/03/diya-mirza.html stunning beauty sneha http://cinyworld96.blogspot.com/2011/03/sneha.html unbelivable iliyana photos http://cinyworld96.blogspot.com/2011/03/iliyana.html priyamani beautiful stills http://cinyworld96.blogspot.com/2011/03/priyamani.html pranitha in half saree http://cinyworld96.blogspot.com/2011/03/pranitha.html richa saree stills http://cinyworld96.blogspot.com/2011/03/richa-gangopadyay.html -- 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] Are U a Student Must Read this Frwd This Please If u Like We R student like You TOO
Your link doesn't work and all the links on the top bar appear to lead to do nothing. Doesn't give a brilliant impression. On 30 March 2011 09:22, ArPiT BhAtNaGaR arpitbhatnagarm...@gmail.comwrote: NIT JAIPUR PRESENTS YOU KAMPUSATTACK.COM http://ampusattack.com/ Biggest Social Platform For Students by Students - Enjoy Spiced up Social Networking With Hot Features! - Get Connected To Constillation Of Young Brains Like You! - Access share useful collection of Ebooks,Notes, Ppt's,Codes,Programs. etc.. - Find Lot Of Humor Fun Inside! - Chat With Spicy Kampus Messenger with new people , Play Amazing Games. *! STAND OUT FROM CROWD !* With Our Useful Resources You Will Never Be Same As Rest Of Crowd - GD 's With Pro's Con's. - INTERVIEW preprations by personal experience of people. - PLACEMENT PAPERS - *College Previous Papers* - *Info About Latest **Technologies Gadgets.* - *Project Ideas help.* - *INTERNSHIP TRANING GUIDANCE.* *! BE CONNECTED AND UPDATED!* - *Connect With Your Pal's , Senior's Alumni's.* - *Exchange Idea's With People Across Kampuses.* *! EXCLUSIVE EXPERT ZONE !* - STEP OUT from other's with our *INDUSTRIAL GUINDANCE* from Adobe , Microsoft, NTPC, BPCL ,Accenture. - Field Experts Career Consultant Inside. Register Today! *WWW.KAMPUSATTACK.COM* http://www.kampusattack.com/ -- Arpit Bhatnagar (MNIT JAIPUR) -- 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] [brain teaser ] 30march
Excellent answer Kunal !! On Wed, Mar 30, 2011 at 1:55 PM, kunal srivastav kunal.shrivas...@gmail.com wrote: grandfather, father and son went for fishing... here we have two fathers and two sons On Wed, Mar 30, 2011 at 1:52 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *Fishing Problem * * *Two fathers and two sons went for fishing. Each of them caught a fish, and none of them caught the same fish. However, they caught a total of only three fish. How is this possible? Update Your Answers at : Click Herehttp://dailybrainteaser.blogspot.com/2011/03/30march.html?lavesh=lavesh Solution: Will be updated after 1 day -- Never explain yourself. Your friends don’t need it and your enemies won’t believe it . -- 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. -- thezeitgeistmovement.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Google News Search API
Hey, Is there any jar file(library) which i could use to write a program in java which takes as input a query and gets back with 8-64 results from google news ? This is link http://code.google.com/apis/newssearch/ which i am referring to, but there is no download section. I am very confused about how to use it. Thanks. Regards, Arpit Sood On Wed, Mar 30, 2011 at 11:31 PM, Jeremy Geerdes jrgeer...@gmail.comwrote: The NewsSearch API is not allowed to obtain more than 8 results per request, and only up to the first 64 results in total. There is no hard query limit, but there are throttling mechanisms designed to detect and crack down on TOS violations such as automated queries. Jeremy R. Geerdes Generally Cool Guy Des Moines, IA For more information or a project quote: jrgeer...@gmail.com If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church! On Mar 30, 2011, at 12:42 PM, Arpit Sood wrote: Hey I am trying to extract top k(say 10) results from a Google news( http://news.google.com/) by taking an query as input, but couldn't do so. Is there a google news search API for java. I want to extract the news or say the hyperlinks pointing to the news. k could go from 10 to 1000. I read somewhere that even after using google api, one can't query google news server for more than 100 times a day ? Here i only want to extract the news title and corresponding hyperlink to it, which i can later download. -- Regards, Arpit Sood -- You received this message because you are subscribed to the Google Groups Google AJAX APIs group. To post to this group, send email to google-ajax-search-...@googlegroups.com. To unsubscribe from this group, send email to google-ajax-search-api+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en. -- You received this message because you are subscribed to the Google Groups Google AJAX APIs group. To post to this group, send email to google-ajax-search-...@googlegroups.com. To unsubscribe from this group, send email to google-ajax-search-api+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en. -- Regards, Arpit Sood -- 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] [brain teaser ] 30march
One is grandpa -- Regards Kunal Yadav (http://algoritmus.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.
Re: [algogeeks] Finding subarray
We did :-) Dynamic programming seems as the best way to approach this kind of problem. On Wed, Mar 30, 2011 at 12:56 AM, Subhransu subhransu.panigr...@gmail.com wrote: For this X = {-1,4,2,3} Nearest will be 4 then remain is 1 but the there is no 1 so again in recursion nearest number is 2 then it search for suitable number where the sum is zero so 3 is not suitable then it will pick the next closest number to 2 which is one and make it (5= 4 + 2 -1 ) I just propose one approach you guys also can think a better one. Subhransu Panigrahi Mobile: +91-9840931538 Email: subhransu.panigr...@gmail.com On Wed, Mar 30, 2011 at 12:55 PM, Saikat Debnath crazysai...@gmail.com wrote: @ Subhranshu : Your approach will fail for a case let X = {-1,4,2,3} and your sum is 5. You will get nearest element 4, but there is no 1 in the set. A DP solution will be like this : Let a[i][j] be the 1 if using the first i elements we can get sum of j, and 0 otherwise. Initialise a[0][j] = 0, a[i][0] = 1; Now a[i][j] = a[i-1][j] | a[i-1][ j - X[i] ], where X[i] is ith element of set X. On Wed, Mar 30, 2011 at 12:35 PM, hammett hamm...@gmail.com wrote: I'd try a tabular approach. Check dynamic programming. Samples like LCS may give you a click. On Tue, Mar 29, 2011 at 11:46 PM, Subhransu subhransu.panigr...@gmail.com wrote: set of integers in an array X that the sum equals a given number N Eg. X = {-1, -3, 5, 13, 2, 24, 9, 3, 3} Lets say the number 5 which can be formed in the following manner 5= 2 + 3 (the values from array). If there is no match it has to return invalid numbers. We also have to see the complexity of the solution. I thought of one approach but not sure if there is more approach where the complexity will be minimal. Lets say sort the array and now take number and find the closest number for that. Then in a recursion manner search for another( Lets say number '5', it search the list and found closest match will be 3. Then recursively search for 3 now where closest match is 2) Any algo with better complexity will be appreciated. Subhransu Panigrahi Email: subhransu.panigr...@gmail.com -- 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. -- Cheers, hammett http://hammett.castleproject.org/ -- 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. -- Cheers, hammett http://hammett.castleproject.org/ -- 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] Finding subarray
could you please point to some similar I just want to validate the approach which I am thinking of. Sent from my iPhone On Mar 31, 2011, at 0:59, hammett hamm...@gmail.com wrote: We did :-) Dynamic programming seems as the best way to approach this kind of problem. On Wed, Mar 30, 2011 at 12:56 AM, Subhransu subhransu.panigr...@gmail.com wrote: For this X = {-1,4,2,3} Nearest will be 4 then remain is 1 but the there is no 1 so again in recursion nearest number is 2 then it search for suitable number where the sum is zero so 3 is not suitable then it will pick the next closest number to 2 which is one and make it (5= 4 + 2 -1 ) I just propose one approach you guys also can think a better one. Subhransu Panigrahi Mobile: +91-9840931538 Email: subhransu.panigr...@gmail.com On Wed, Mar 30, 2011 at 12:55 PM, Saikat Debnath crazysai...@gmail.com wrote: @ Subhranshu : Your approach will fail for a case let X = {-1,4,2,3} and your sum is 5. You will get nearest element 4, but there is no 1 in the set. A DP solution will be like this : Let a[i][j] be the 1 if using the first i elements we can get sum of j, and 0 otherwise. Initialise a[0][j] = 0, a[i][0] = 1; Now a[i][j] = a[i-1][j] | a[i-1][ j - X[i] ], where X[i] is ith element of set X. On Wed, Mar 30, 2011 at 12:35 PM, hammett hamm...@gmail.com wrote: I'd try a tabular approach. Check dynamic programming. Samples like LCS may give you a click. On Tue, Mar 29, 2011 at 11:46 PM, Subhransu subhransu.panigr...@gmail.com wrote: set of integers in an array X that the sum equals a given number N Eg. X = {-1, -3, 5, 13, 2, 24, 9, 3, 3} Lets say the number 5 which can be formed in the following manner 5= 2 + 3 (the values from array). If there is no match it has to return invalid numbers. We also have to see the complexity of the solution. I thought of one approach but not sure if there is more approach where the complexity will be minimal. Lets say sort the array and now take number and find the closest number for that. Then in a recursion manner search for another( Lets say number '5', it search the list and found closest match will be 3. Then recursively search for 3 now where closest match is 2) Any algo with better complexity will be appreciated. Subhransu Panigrahi Email: subhransu.panigr...@gmail.com -- 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. -- Cheers, hammett http://hammett.castleproject.org/ -- 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. -- Cheers, hammett http://hammett.castleproject.org/ -- 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] Converting jpeg to bmp file
Hello, I'm trying create a program in a Free C++ compiler (CygWin) to load a Jpeg file and save to bmp, but I don't have the package or library correct. I'm using Code::Blocks pure c++. If anybody have some trick that help me, I thank You, very much. -- Luciano Soares Pinheiro Jr. Analista desenvolvedor Sr. -- 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] Converting jpeg to bmp file
In order to convert, you'd have to study the format of jpeg. I'd start looking at the format description http://en.wikipedia.org/wiki/JPEG decompressing should give you something closer to a bitmap. On Wed, Mar 30, 2011 at 12:42 PM, Luciano Junior luciano@gmail.com wrote: Hello, I'm trying create a program in a Free C++ compiler (CygWin) to load a Jpeg file and save to bmp, but I don't have the package or library correct. I'm using Code::Blocks pure c++. If anybody have some trick that help me, I thank You, very much. -- Luciano Soares Pinheiro Jr. Analista desenvolvedor Sr. -- 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. -- Cheers, hammett http://hammett.castleproject.org/ -- 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 o/p gud one try
these kind of question are compiler dependent if you are preparing for interview than these kind of questions are not asked On Tue, Mar 29, 2011 at 10:42 PM, kunal srivastav kunal.shrivas...@gmail.com wrote: refer let us c by YK fr these type of ques On Tue, Mar 29, 2011 at 10:07 PM, ArPiT BhAtNaGaR arpitbhatnagarm...@gmail.com wrote: please do answer geeks me waiting On Mon, Mar 28, 2011 at 11:14 PM, ArPiT BhAtNaGaR arpitbhatnagarm...@gmail.com wrote: #includestdio.h main() { long x; float t; scanf(%f,t); printf(%d\n,t); x=90; printf(%f\n,x); { x=1; printf(%f\n,x); { x=30; printf(%f\n,x); } printf(%f\n,x); } x==9; printf(%f\n,x); } o/p on gcc compiler 20.3 (i/p given) -1073741824 20.299988 20.299988 20.299988 20.299988 20.299988 plz explain the o/p -- Arpit Bhatnagar (MNIT JAIPUR) -- Arpit Bhatnagar (MNIT JAIPUR) -- 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. -- thezeitgeistmovement.com -- 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. -- SOURABH JAKHAR,(CSE)(3 year) ROOM NO 167 , TILAK,HOSTEL 'MNNIT ALLAHABAD The Law of Win says, Let's not do it your way or my way; let's do it the best way. -- 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] [brain teaser ] 29march
122 On Tue, Mar 29, 2011 at 6:51 PM, Carl Barton odysseus.ulys...@gmail.comwrote: Agreed, 122 On 29 March 2011 14:19, Kunal Yadav kunalyada...@gmail.com wrote: 122 1, 2, 5, 14, 41, x Whats x ?? -- Regards Kunal Yadav (http://algoritmus.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. -- SOURABH JAKHAR,(CSE)(3 year) ROOM NO 167 , TILAK,HOSTEL 'MNNIT ALLAHABAD The Law of Win says, Let's not do it your way or my way; let's do it the best way. -- 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: 28march
answer is 6 races On Mon, Mar 28, 2011 at 11:53 PM, Dave dave_and_da...@juno.com wrote: 7 races. For the first five races, divide the horses into groups of five and record the win, place, and show finishers of each race. For the sixth race, run the winners of the first five races. Now, only six horses remain in contention for the fastest three: The winner of the sixth race and the place and show horses of his first race, The place horse in the sixth race and the place horse in his first race. The show horse in the sixth race. Three of these horses are known to be faster than all other horses. The winner of the sixth race is known to be the fastest horse. Run the other five contenders in race 7 and choose the fastest two. Dave On Mar 28, 2:54 am, Lavesh Rawat lavesh.ra...@gmail.com wrote: *Horse Race Problem Solution* * *Ok, so there are 25 horses and the race track only allows 5 horses to race at a given time. Given that there is no stop watch available your task is to determine the fastest 3 horses. Assume that each horses speed is constant in different races, what is the minimum number of races to determine the fastest 3? Update Your Answers at : Click Here http://dailybrainteaser.blogspot.com/2011/03/28march.html?lavesh=lavesh Solution: Will be updated after 1 day -- Never explain yourself. Your friends don’t need it and your enemies won’t believe it . -- 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. -- SOURABH JAKHAR,(CSE)(3 year) ROOM NO 167 , TILAK,HOSTEL 'MNNIT ALLAHABAD The Law of Win says, Let's not do it your way or my way; let's do it the best way. -- 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] [brain teaser ] 29march
1+1+0, 2+2+1, 5+5+4, 14+14+13, 41+41+40 On Tue, Mar 29, 2011 at 1:05 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *Series Problem Solution* 1, 2, 5, 14, 41, x Whats x ?? Update Your Answers at : Click Herehttp://dailybrainteaser.blogspot.com/2011/03/29march.html?lavesh=lavesh Solution: Will be updated after 1 day -- Never explain yourself. Your friends don’t need it and your enemies won’t believe it . -- 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.