Re: [algogeeks] sql queries
thanks buddy. On Tue, Sep 14, 2010 at 9:41 AM, sharad kumar aryansmit3...@gmail.comwrote: teach ur self sql in 24 hrs. or use oracle complete guide.the fat book On Tue, Sep 14, 2010 at 6:50 AM, Ayush Mittal ayushmittal2...@gmail.comwrote: can anybody tell me how to command on sql queries? please refer books and sites where i can practice important queries.! -- 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. -- yezhu malai vaasa venkataramana Govinda Govinda -- 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] clear screen in mysql
what is the command to clear screen in mysql..? -- 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] clear screen in mysql
See it here : jfgi http://www.urbandictionary.com/define.php?term=jfgi -- 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] clear screen in mysql
whats this...? On Tue, Sep 14, 2010 at 12:07 PM, Rohit Saraf rohit.kumar.sa...@gmail.comwrote: See it here : jfgi http://www.urbandictionary.com/define.php?term=jfgi -- 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: Google Interview Question-Snake and Ladder Design
#includestdlib.h #includestdio.h #includemath.h #includeconio.h ///O(N^2) solution Does solution exits in O(n) or (nlogn)..? reply me sum1 git dis.. //i will post analysis of dsi program later int turn, square; long game, totalgames; int seed; int chutehit[10], ladderhit[9]; float RunningTurnTotal; float average; char reply; void ChuteStats() {printf(Chute and Ladder Statistics:\n\n); printf(Chute0: %d Ladder0: %d\n, chutehit[0], ladderhit[0]); printf(Chute1: %d Ladder1: %d\n, chutehit[1], ladderhit[1]); printf(Chute2: %d Ladder2: %d\n, chutehit[2], ladderhit[2]); printf(Chute3: %d Ladder3: %d\n, chutehit[3], ladderhit[3]); printf(Chute4: %d Ladder4: %d\n, chutehit[4], ladderhit[4]); printf(Chute5: %d Ladder5: %d\n, chutehit[5], ladderhit[5]); printf(Chute6: %d Ladder6: %d\n, chutehit[6], ladderhit[6]); printf(Chute7: %d Ladder7: %d\n, chutehit[7], ladderhit[7]); printf(Chute8: %d Ladder8: %d\n, chutehit[8], ladderhit[8]); printf(Chute9: %d\n, chutehit[9]); } int main() { printf(Welcome to the Chutes and Ladders simulation \n); printf(...\n); srand(1); //printf(How many games would you like me to run? __ ); //scanf(%i,totalgames); ///printf(\n You have chosen to run %i games... thank you! \n, totalgames); totalgames+=2; RunningTurnTotal=0.0; game=1; do{ turn=0; square=0; /** Reset game **/ do /** Begin game loop **/ { ++turn; RunningTurnTotal = RunningTurnTotal + 1; square = square + 1 + rand()%6; /** Spin and move **/ printf(square =%d \n,square); if (square == 1) {square=23; ++ladderhit[0];} /** Ladders? **/ if (square == 4) {square=14; ++ladderhit[1];} if (square == 9) {square=31; ++ladderhit[2];} if (square == 21) {square=42; ++ladderhit[3];} if (square == 28) {square=84; ++ladderhit[4];} if (square == 36) {square=44; ++ladderhit[5];} if (square == 51) {square=67; ++ladderhit[6];} if (square == 71) {square=91; ++ladderhit[7];} if (square == 80) {square=100;++ladderhit[8];}/// so when 80 comes raech to our goal exit if (square == 98) {square=78; ++chutehit[0];} /** Chutes ? **/ if (square == 95) {square=75; ++chutehit[1];} if (square == 93) {square=73; ++chutehit[2];} if (square == 87) {square=24; ++chutehit[3];} if (square == 62) {square=19; ++chutehit[4];} if (square == 64) {square=60; ++chutehit[5];} if (square == 56) {square=53; ++chutehit[6];} if (square == 49) {square=11; ++chutehit[7];} if (square == 48) {square=26; ++chutehit[8];} if (square == 16) {square=6; ++chutehit[9];} } while (square100);//terminate if random no. is 100 printf(\n\n Game over after %d turns\n, turn); printf(\nSimulation complete... beginning statistical analysis...\n\n); printf(Total number of games played: %d \n, game); printf(Total number of turns: %f \n, RunningTurnTotal); average = RunningTurnTotal / game; printf(Avg number of turns per game: %f \n, average); printf(\n); ChuteStats(); printf(\n); ++game; printf(\n\n Would you like to run the simulation again? (1=Yes)...); scanf(%i,reply); if(reply==1)//e.g. reply==1 totalgames+=1; else exit(0);// exit } while (gametotalgames); getch(); } -- 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:Google Interview Question-Snake and Ladder Design
#includestdlib.h #includestdio.h #includemath.h #includeconio.h int turn, square; long game, totalgames; int seed; int chutehit[10], ladderhit[9]; float RunningTurnTotal; float average; char reply; void ChuteStats() {printf(Chute and Ladder Statistics:\n\n); printf(Chute0: %d Ladder0: %d\n, chutehit[0], ladderhit[0]); printf(Chute1: %d Ladder1: %d\n, chutehit[1], ladderhit[1]); printf(Chute2: %d Ladder2: %d\n, chutehit[2], ladderhit[2]); printf(Chute3: %d Ladder3: %d\n, chutehit[3], ladderhit[3]); printf(Chute4: %d Ladder4: %d\n, chutehit[4], ladderhit[4]); printf(Chute5: %d Ladder5: %d\n, chutehit[5], ladderhit[5]); printf(Chute6: %d Ladder6: %d\n, chutehit[6], ladderhit[6]); printf(Chute7: %d Ladder7: %d\n, chutehit[7], ladderhit[7]); printf(Chute8: %d Ladder8: %d\n, chutehit[8], ladderhit[8]); printf(Chute9: %d\n, chutehit[9]); } int main() { printf(Welcome to the Chutes and Ladders simulation \n); printf(...\n); srand(1); //printf(How many games would you like me to run? __ ); //scanf(%i,totalgames); ///printf(\n You have chosen to run %i games... thank you! \n, totalgames); totalgames+=2; RunningTurnTotal=0.0; game=1; do{ turn=0; square=0; /** Reset game **/ do /** Begin game loop **/ { ++turn; RunningTurnTotal = RunningTurnTotal + 1; square = square + 1 + rand()%6; /** Spin and move **/ printf(square =%d \n,square); if (square == 1) {square=23; ++ladderhit[0];} /** Ladders? **/ if (square == 4) {square=14; ++ladderhit[1];} if (square == 9) {square=31; ++ladderhit[2];} if (square == 21) {square=42; ++ladderhit[3];} if (square == 28) {square=84; ++ladderhit[4];} if (square == 36) {square=44; ++ladderhit[5];} if (square == 51) {square=67; ++ladderhit[6];} if (square == 71) {square=91; ++ladderhit[7];} if (square == 80) {square=100;++ladderhit[8];}/// so when 80 comes raech to our goal exit if (square == 98) {square=78; ++chutehit[0];} /** Chutes ? **/ if (square == 95) {square=75; ++chutehit[1];} if (square == 93) {square=73; ++chutehit[2];} if (square == 87) {square=24; ++chutehit[3];} if (square == 62) {square=19; ++chutehit[4];} if (square == 64) {square=60; ++chutehit[5];} if (square == 56) {square=53; ++chutehit[6];} if (square == 49) {square=11; ++chutehit[7];} if (square == 48) {square=26; ++chutehit[8];} if (square == 16) {square=6; ++chutehit[9];} } while (square100);//terminate if random no. is 100 printf(\n\n Game over after %d turns\n, turn); printf(\nSimulation complete... beginning statistical analysis...\n\n); printf(Total number of games played: %d \n, game); printf(Total number of turns: %f \n, RunningTurnTotal); average = RunningTurnTotal / game; printf(Avg number of turns per game: %f \n, average); printf(\n); ChuteStats(); printf(\n); ++game; printf(\n\n Would you like to run the simulation again? (1=Yes)...); scanf(%i,reply); if(reply==1)//e.g. reply==1 totalgames+=1; else exit(0);// exit } while (gametotalgames); getch(); } ///O(N^2) solution Does solution exits in O(n) or (nlogn)..? reply me sum1 git dis.. //i will post analysis of dsi program later i m solving usig OOPS (Java) to represnt everything as object //right me if i m wrong or hw we can improve dis alog. Regards Shashank Mani Don't Be Evil u Can Earn While U Learn BIT Mesra-2010 09166674831 -- 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!!!! Puzzle
You are on a strict medical regimen that requires you to take two types of pills each day. You must take exactly one A pill and exactly one B pill at the same time. The pills are very expensive, and you don't want to waste any. So you open the bottle of A pills, and tap one out into your hand. Then you open the bottle of B pills and do the same thing -- but you make a mistake, and two B pills come out into your hand with the A pill. But the pills are all exactly identical. There is no way to tell A pills apart from B pills. How can you satisfy your regimen and take exactly one of each pill at the same time, without wasting any pills? Write Algorithm to Solve dis Problem in O(1) Regard's Shashank Mani Narayan Don't Be Evil U Can Earn While U learn Computer Science Engineering Birla Institute of Technology,Mesra Cell No. +91-9166674831 -- 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!!!! Puzzle
You are on a strict medical regimen that requires you to take two types of pills each day. You must take exactly one A pill and exactly one B pill at the same time. The pills are very expensive, and you don't want to waste any. So you open the bottle of A pills, and tap one out into your hand. Then you open the bottle of B pills and do the same thing -- but you make a mistake, and two B pills come out into your hand with the A pill. But the pills are all exactly identical. There is no way to tell A pills apart from B pills. How can you satisfy your regimen and take exactly one of each pill at the same time, without wasting any pills? Write Algorithm to Solve dis Problem in constant time..isn't it..??? Regard's Shashank Mani Narayan Don't Be Evil U Can Earn While U learn Computer Science Engineering Birla Institute of Technology,Mesra Cell No. +91-9166674831 -- 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: Write a program to arrange numbers from 1 to 16 such that the sum of two consecutive numbers is a perfect square
@Davhw can u compute in contant time where runing time dwepends on elements of array e.g. its has complexcity O(n) isn'tit..?? import java.util.Arrays; import java.util.LinkedList; class SolutionFinder { public static void find(final LinkedListInteger remaining, final LinkedListInteger found) { if (remaining.size() == 0) // We made it through the whole list, this is a solution { for (final Integer curr : found) { System.out.printf(%d , curr); } } else { for (int i = 0; i remaining.size(); i++) { final Integer next = remaining.get(i); System.out.print(next \t + next); int size=found.size()-1; Integer fnd=found.get(size);//always return last System.out.print(\t fnd \t + fnd + \n); if (Arrays.asList(4, 9, 16, 25).contains(fnd+ next)) { found.add(remaining.remove(i)); find(remaining, found); remaining.add(i, found.remove(found.size() - 1)); } } } } public static void main(final String[] args) { final LinkedListInteger remaining = new LinkedListInteger(); final LinkedListInteger found = new LinkedListInteger(); for (int i = 1; i = 15; i++) { remaining.add(i); } found.add(16); find(remaining, found); } } Right me if i m wrong Regard's Shashank Mani Narayan Don't Be Evil U Can Earn While U learn Computer Science Engineering Birla Institute of Technology,Mesra Cell No. +91-9166674831 -- 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:Write a program to arrange numbers from 1 to 16 such that the sum of two consecutive numbers is a perfect square
@Davhw can u compute in contant time where runing time dwepends on elements of array e.g. its has complexcity O(n) isn'tit..?? import java.util.Arrays; import java.util.LinkedList; class SolutionFinder { public static void find(final LinkedListInteger remaining, final LinkedListInteger found) { if (remaining.size() == 0) // We made it through the whole list, this is a solution { for (final Integer curr : found) { System.out.printf(%d , curr); } } else { for (int i = 0; i remaining.size(); i++) { final Integer next = remaining.get(i); System.out.print(next \t + next); int size=found.size()-1; Integer fnd=found.get(size);//always return last System.out.print(\t fnd \t + fnd + \n); if (Arrays.asList(4, 9, 16, 25).contains(fnd+ next)) { found.add(remaining.remove(i)); find(remaining, found); remaining.add(i, found.remove(found.size() - 1)); } } } } public static void main(final String[] args) { final LinkedListInteger remaining = new LinkedListInteger(); final LinkedListInteger found = new LinkedListInteger(); for (int i = 1; i = 15; i++) { remaining.add(i); } found.add(16); find(remaining, found); } } Right me if i m wrong Regard's Shashank Mani Narayan Don't Be Evil U Can Earn While U learn Computer Science Engineering Birla Institute of Technology,Mesra Cell No. +91-9166674831 -- 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] Amazon Question make confused !!!!!!!
Amazon Interview Question for Software Engineer / Developers A car has speed of 72 64 56 in downhill, plain and uphill respectively . A guy travels in the car from Pt. A to pt. B in 4 Hrs and pt. B to pt. A in 4 Hrs and 40 min. what is the distance between A and B? Regards Shashank -- 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!!!! Puzzle
take out that one A pill that's there in the jar. take the half of all the four pills, that's how u'll make sure that u've had 1 of 'A' and 1 of 'B' pill. On Tue, Sep 14, 2010 at 2:52 PM, bittu shashank7andr...@gmail.com wrote: You are on a strict medical regimen that requires you to take two types of pills each day. You must take exactly one A pill and exactly one B pill at the same time. The pills are very expensive, and you don't want to waste any. So you open the bottle of A pills, and tap one out into your hand. Then you open the bottle of B pills and do the same thing -- but you make a mistake, and two B pills come out into your hand with the A pill. But the pills are all exactly identical. There is no way to tell A pills apart from B pills. How can you satisfy your regimen and take exactly one of each pill at the same time, without wasting any pills? Write Algorithm to Solve dis Problem in constant time..isn't it..??? Regard's Shashank Mani Narayan Don't Be Evil U Can Earn While U learn Computer Science Engineering Birla Institute of Technology,Mesra Cell No. +91-9166674831 -- 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: Given an array, find out if there exists a pair of nos. that adds up to a sum 'x'
#include iostream #include cstring #include conio.h using namespace std; int main() { int n,a[30],temp[30],x; cin n; memset(temp,0,sizeof(temp)); for(int i=0;in;i++) cin a[i]; cin x; temp[x-a[0]]=1; for(int i=1;in;i++) { if(temp[a[i]]==1) cout a[i] x-a[i]; else temp[x-a[i]]=1; } getch(); } correct me if i am 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] Amazon Question
Given 2 linked lists(which need not have unique elements) find intersection point in the form of Y.(it can be anywhere--middle or tail) Regards Shashank -- 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 make confused !!!!!!!
x/72 + y/64 + z/56 = 4 x/56 + y/64 + z/72 = 4+2/3 find a solution to this ... On Tue, Sep 14, 2010 at 2:31 AM, bittu shashank7andr...@gmail.com wrote: Amazon Interview Question for Software Engineer / Developers A car has speed of 72 64 56 in downhill, plain and uphill respectively . A guy travels in the car from Pt. A to pt. B in 4 Hrs and pt. B to pt. A in 4 Hrs and 40 min. what is the distance between A and B? Regards Shashank -- 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. -- 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 make confused !!!!!!!
how can u solve 3 variables using 2 equations? On Tue, Sep 14, 2010 at 3:44 PM, Yan Wang wangyanadam1...@gmail.com wrote: x/72 + y/64 + z/56 = 4 x/56 + y/64 + z/72 = 4+2/3 find a solution to this ... On Tue, Sep 14, 2010 at 2:31 AM, bittu shashank7andr...@gmail.com wrote: Amazon Interview Question for Software Engineer / Developers A car has speed of 72 64 56 in downhill, plain and uphill respectively . A guy travels in the car from Pt. A to pt. B in 4 Hrs and pt. B to pt. A in 4 Hrs and 40 min. what is the distance between A and B? Regards Shashank -- 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] Amazon Question make confused !!!!!!!
actually, there are many solutions, just pick up one from them... On Tue, Sep 14, 2010 at 3:23 AM, Abhilasha jain mail2abhila...@gmail.com wrote: how can u solve 3 variables using 2 equations? On Tue, Sep 14, 2010 at 3:44 PM, Yan Wang wangyanadam1...@gmail.com wrote: x/72 + y/64 + z/56 = 4 x/56 + y/64 + z/72 = 4+2/3 find a solution to this ... On Tue, Sep 14, 2010 at 2:31 AM, bittu shashank7andr...@gmail.com wrote: Amazon Interview Question for Software Engineer / Developers A car has speed of 72 64 56 in downhill, plain and uphill respectively . A guy travels in the car from Pt. A to pt. B in 4 Hrs and pt. B to pt. A in 4 Hrs and 40 min. what is the distance between A and B? Regards Shashank -- 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. -- 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. -- 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. -- 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] clear screen in mysql
well i just wanted u to know that there is a very nice place called www.google,com where u can find many things. -- 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] clear screen in mysql
thanks man bt i hve searched a lot bt couln't find it...if u could help me plz...? On Tue, Sep 14, 2010 at 4:27 PM, Rohit Saraf rohit.kumar.sa...@gmail.comwrote: well i just wanted u to know that there is a very nice place called www.google,com where u can find many things. -- 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: Amazon Question
From first linked list set flag value in each traversal of node..then start from second linked list suppose if flag value is already set that is the intersection point correct me if i am 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] Drawing a graph
Can anyone help me with the code for drawing a graph in C or CPP (using graphics) Input is an Adjacency matrix -- 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: Write a program to arrange numbers from 1 to 16 such that the sum of two consecutive numbers is a perfect square
@Bittu: First, it makes no sense to say O(n) when n is fixed. Second, if you know the solution, a program to print it out just consists of a printf statement, e.g., printf(16, 9, 7, 2, 14, 11, 5, 4, 12, 13, 3, 6, 10, 15, 1, 8\n); plus whatever language stuff you need to get it to compile and run. Dave On Sep 14, 4:26 am, bittu shashank7andr...@gmail.com wrote: @Davhw can u compute in contant time where runing time dwepends on elements of array e.g. its has complexcity O(n) isn'tit..?? import java.util.Arrays; import java.util.LinkedList; class SolutionFinder { public static void find(final LinkedListInteger remaining, final LinkedListInteger found) { if (remaining.size() == 0) // We made it through the whole list, this is a solution { for (final Integer curr : found) { System.out.printf(%d , curr);} } else { for (int i = 0; i remaining.size(); i++) { final Integer next = remaining.get(i); System.out.print(next \t + next); int size=found.size()-1; Integer fnd=found.get(size);//always return last System.out.print(\t fnd \t + fnd + \n); if (Arrays.asList(4, 9, 16, 25).contains(fnd+ next)) { found.add(remaining.remove(i)); find(remaining, found); remaining.add(i, found.remove(found.size() - 1)); } } } } public static void main(final String[] args) { final LinkedListInteger remaining = new LinkedListInteger(); final LinkedListInteger found = new LinkedListInteger(); for (int i = 1; i = 15; i++) { remaining.add(i);} found.add(16); find(remaining, found); } } Right me if i m wrong Regard's Shashank Mani Narayan Don't Be Evil U Can Earn While U learn Computer Science Engineering Birla Institute of Technology,Mesra Cell No. +91-9166674831 -- 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] Google Interview Question
Write a function Brackets(int n) that prints all combinations of well- formed brackets. For Brackets(3) the output would be ((())) (()()) (()) () ()(()) ()()() -- 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] Google Interview Question
Write a function Brackets(int n) that prints all combinations of well- formed brackets. For Brackets(3) the output would be ((())) (()()) (()) () ()(()) ()()() with explaination dat is at every call what is contant of stack during pushing and popping -- 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:Google Interview Question-Snake and Ladder Design
@bittuu write your algo then code On Tue, Sep 14, 2010 at 1:36 PM, bittu shashank7andr...@gmail.com wrote: #includestdlib.h #includestdio.h #includemath.h #includeconio.h int turn, square; long game, totalgames; int seed; int chutehit[10], ladderhit[9]; float RunningTurnTotal; float average; char reply; void ChuteStats() {printf(Chute and Ladder Statistics:\n\n); printf(Chute0: %d Ladder0: %d\n, chutehit[0], ladderhit[0]); printf(Chute1: %d Ladder1: %d\n, chutehit[1], ladderhit[1]); printf(Chute2: %d Ladder2: %d\n, chutehit[2], ladderhit[2]); printf(Chute3: %d Ladder3: %d\n, chutehit[3], ladderhit[3]); printf(Chute4: %d Ladder4: %d\n, chutehit[4], ladderhit[4]); printf(Chute5: %d Ladder5: %d\n, chutehit[5], ladderhit[5]); printf(Chute6: %d Ladder6: %d\n, chutehit[6], ladderhit[6]); printf(Chute7: %d Ladder7: %d\n, chutehit[7], ladderhit[7]); printf(Chute8: %d Ladder8: %d\n, chutehit[8], ladderhit[8]); printf(Chute9: %d\n, chutehit[9]); } int main() { printf(Welcome to the Chutes and Ladders simulation \n); printf(...\n); srand(1); //printf(How many games would you like me to run? __ ); //scanf(%i,totalgames); ///printf(\n You have chosen to run %i games... thank you! \n, totalgames); totalgames+=2; RunningTurnTotal=0.0; game=1; do{ turn=0; square=0; /** Reset game **/ do /** Begin game loop **/ { ++turn; RunningTurnTotal = RunningTurnTotal + 1; square = square + 1 + rand()%6; /** Spin and move **/ printf(square =%d \n,square); if (square == 1) {square=23; ++ladderhit[0];} /** Ladders? **/ if (square == 4) {square=14; ++ladderhit[1];} if (square == 9) {square=31; ++ladderhit[2];} if (square == 21) {square=42; ++ladderhit[3];} if (square == 28) {square=84; ++ladderhit[4];} if (square == 36) {square=44; ++ladderhit[5];} if (square == 51) {square=67; ++ladderhit[6];} if (square == 71) {square=91; ++ladderhit[7];} if (square == 80) {square=100;++ladderhit[8];}/// so when 80 comes raech to our goal exit if (square == 98) {square=78; ++chutehit[0];} /** Chutes ? **/ if (square == 95) {square=75; ++chutehit[1];} if (square == 93) {square=73; ++chutehit[2];} if (square == 87) {square=24; ++chutehit[3];} if (square == 62) {square=19; ++chutehit[4];} if (square == 64) {square=60; ++chutehit[5];} if (square == 56) {square=53; ++chutehit[6];} if (square == 49) {square=11; ++chutehit[7];} if (square == 48) {square=26; ++chutehit[8];} if (square == 16) {square=6; ++chutehit[9];} } while (square100);//terminate if random no. is 100 printf(\n\n Game over after %d turns\n, turn); printf(\nSimulation complete... beginning statistical analysis...\n\n); printf(Total number of games played: %d \n, game); printf(Total number of turns: %f \n, RunningTurnTotal); average = RunningTurnTotal / game; printf(Avg number of turns per game: %f \n, average); printf(\n); ChuteStats(); printf(\n); ++game; printf(\n\n Would you like to run the simulation again? (1=Yes)...); scanf(%i,reply); if(reply==1)//e.g. reply==1 totalgames+=1; else exit(0);// exit } while (gametotalgames); getch(); } ///O(N^2) solution Does solution exits in O(n) or (nlogn)..? reply me sum1 git dis.. //i will post analysis of dsi program later i m solving usig OOPS (Java) to represnt everything as object //right me if i m wrong or hw we can improve dis alog. Regards Shashank Mani Don't Be Evil u Can Earn While U Learn BIT Mesra-2010 09166674831 -- 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 Ankur Aggarwal +91-7838289304 Software Engineer Slideshare Delhi INDIA. -- 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!!!! Puzzle
No coding at all. 1) Take out another A pill from the bottle; 2) Split each of the 4 pills into two equal halves, and take one half of echo pill. 3) Collect the other half of the 4 pills for next time. On 2010-9-14 17:22, bittu wrote: You are on a strict medical regimen that requires you to take two types of pills each day. You must take exactly one A pill and exactly one B pill at the same time. The pills are very expensive, and you don't want to waste any. So you open the bottle of A pills, and tap one out into your hand. Then you open the bottle of B pills and do the same thing -- but you make a mistake, and two B pills come out into your hand with the A pill. But the pills are all exactly identical. There is no way to tell A pills apart from B pills. How can you satisfy your regimen and take exactly one of each pill at the same time, without wasting any pills? Write Algorithm to Solve dis Problem in O(1) Regard's Shashank Mani Narayan Don't Be Evil U Can Earn While U learn Computer Science Engineering Birla Institute of Technology,Mesra Cell No. +91-9166674831 -- 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] clear screen in mysql
http://lmgtfy.com/?q=how+to+clear+screen+in+mysql On Tue, Sep 14, 2010 at 4:48 PM, Ayush Mittal ayushmittal2...@gmail.com wrote: thanks man bt i hve searched a lot bt couln't find it...if u could help me plz...? On Tue, Sep 14, 2010 at 4:27 PM, Rohit Saraf rohit.kumar.sa...@gmail.com wrote: well i just wanted u to know that there is a very nice place called www.google,com where u can find many things. -- 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] Yahoo!!!! Puzzle
How_to_Ace_the_Brainteaser_Interview.pdf find this book, this has good number of puzzles. Thanks, Sathaiah Dontula On Tue, Sep 14, 2010 at 3:01 PM, vishal raja vishal.ge...@gmail.com wrote: take out that one A pill that's there in the jar. take the half of all the four pills, that's how u'll make sure that u've had 1 of 'A' and 1 of 'B' pill. On Tue, Sep 14, 2010 at 2:52 PM, bittu shashank7andr...@gmail.com wrote: You are on a strict medical regimen that requires you to take two types of pills each day. You must take exactly one A pill and exactly one B pill at the same time. The pills are very expensive, and you don't want to waste any. So you open the bottle of A pills, and tap one out into your hand. Then you open the bottle of B pills and do the same thing -- but you make a mistake, and two B pills come out into your hand with the A pill. But the pills are all exactly identical. There is no way to tell A pills apart from B pills. How can you satisfy your regimen and take exactly one of each pill at the same time, without wasting any pills? Write Algorithm to Solve dis Problem in constant time..isn't it..??? Regard's Shashank Mani Narayan Don't Be Evil U Can Earn While U learn Computer Science Engineering Birla Institute of Technology,Mesra Cell No. +91-9166674831 -- 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] clear screen in mysql
+1 On Tue, Sep 14, 2010 at 4:27 PM, Rohit Saraf rohit.kumar.sa...@gmail.comwrote: well i just wanted u to know that there is a very nice place called www.google,com where u can find many things. -- 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. -- Thanks Regards, Chakravarthi. -- 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: Given an array, find out if there exists a pair of nos. that adds up to a sum 'x'
A very nice explanation at http://www.rawkam.com/?p=345 On Tue, Sep 14, 2010 at 3:16 PM, soundar soundha...@gmail.com wrote: #include iostream #include cstring #include conio.h using namespace std; int main() { int n,a[30],temp[30],x; cin n; memset(temp,0,sizeof(temp)); for(int i=0;in;i++) cin a[i]; cin x; temp[x-a[0]]=1; for(int i=1;in;i++) { if(temp[a[i]]==1) cout a[i] x-a[i]; else temp[x-a[i]]=1; } getch(); } correct me if i am 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.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] Google Interview Question
Number of correctly matched pair of n parenthesis will be a catalan number Cn. You may want to see the application of catalan numbers at http://www.rawkam.com/?p=568 http://www.rawkam.com/?p=568 On Tue, Sep 14, 2010 at 8:27 PM, bittu shashank7andr...@gmail.com wrote: Write a function Brackets(int n) that prints all combinations of well- formed brackets. For Brackets(3) the output would be ((())) (()()) (()) () ()(()) ()()() with explaination dat is at every call what is contant of stack during pushing and popping -- 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: Google Interview Question
You can approach this the same way you'd do it by hand. Build up the string of brackets left to right. For each position, you have a decision of either ( or ) bracket except for two constraints: (1) if you've already decided to use n left brackets, then you can't use a another left bracket and (2) if you've already used as many right as left brackets, then you can't use another right one. This suggests the following alorithm. Showing what happens on the stack is a silly activity. #include stdio.h // Buffer for strings of (). char buf[1000]; // Continue the printing of bracket strings. // need is the number of ('s still needed in our string. // open is tne number of ('s already used _without_ a matching ). // tail is the buffer location to place the next ) or (. void cont(int need, int open, int tail) { // If nothing needed or open, we're done. Print. if (need == 0 open == 0) { printf(%s\n, buf); return; } // If still a need for (, add a ( and continue. if (need 0) { buf[tail] = '('; cont(need - 1, open + 1, tail + 1); } // If still an open (, add a ) and continue. if (open 0) { buf[tail] = ')'; cont(need, open - 1, tail + 1); } } void Brackets(int n) { cont(n, 0, 0); } int main(void) { Brackets(3); return 0; } On Sep 14, 10:57 am, bittu shashank7andr...@gmail.com wrote: Write a function Brackets(int n) that prints all combinations of well- formed brackets. For Brackets(3) the output would be ((())) (()()) (()) () ()(()) ()()() with explaination dat is at every call what is contant of stack during pushing and popping -- 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] Amazon Question
Suppose you have a system that keeps track of thousands of users' contact information, including email address. This information is stored in plain text, on disk in a hierarchical directory structure (on a Unix operating system) organized by year, month, and day it was entered in the system. Something bad happens and the system crashes. We want to get the email address of all these users to notify them. How would you parse these directories and files to generate a simple list of email addresses? Regards Shashank -- 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] Google Interview Question
how to decrypt a dictionary and how multithreading can help make the process faster -- 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: Google Interview Question-Snake and Ladder Design
Hi On 14 September 2010 13:33, bittu shashank7andr...@gmail.com wrote: #includestdlib.h #includestdio.h #includemath.h #includeconio.h ///O(N^2) solution Does solution exits in O(n) or (nlogn)..? reply me sum1 git dis.. //i will post analysis of dsi program later int turn, square; long game, totalgames; int seed; int chutehit[10], ladderhit[9]; float RunningTurnTotal; float average; char reply; void ChuteStats() {printf(Chute and Ladder Statistics:\n\n); printf(Chute0: %d Ladder0: %d\n, chutehit[0], ladderhit[0]); printf(Chute1: %d Ladder1: %d\n, chutehit[1], ladderhit[1]); printf(Chute2: %d Ladder2: %d\n, chutehit[2], ladderhit[2]); printf(Chute3: %d Ladder3: %d\n, chutehit[3], ladderhit[3]); printf(Chute4: %d Ladder4: %d\n, chutehit[4], ladderhit[4]); printf(Chute5: %d Ladder5: %d\n, chutehit[5], ladderhit[5]); printf(Chute6: %d Ladder6: %d\n, chutehit[6], ladderhit[6]); printf(Chute7: %d Ladder7: %d\n, chutehit[7], ladderhit[7]); printf(Chute8: %d Ladder8: %d\n, chutehit[8], ladderhit[8]); printf(Chute9: %d\n, chutehit[9]); } int main() { printf(Welcome to the Chutes and Ladders simulation \n); printf(...\n); srand(1); //printf(How many games would you like me to run? __ ); //scanf(%i,totalgames); ///printf(\n You have chosen to run %i games... thank you! \n, totalgames); totalgames+=2; RunningTurnTotal=0.0; game=1; do{ turn=0; square=0; /** Reset game **/ do /** Begin game loop **/ { ++turn; RunningTurnTotal = RunningTurnTotal + 1; square = square + 1 + rand()%6; /** Spin and move **/ printf(square =%d \n,square); if (square == 1) {square=23; ++ladderhit[0];} /** Ladders? **/ if (square == 4) {square=14; ++ladderhit[1];} if (square == 9) {square=31; ++ladderhit[2];} if (square == 21) {square=42; ++ladderhit[3];} if (square == 28) {square=84; ++ladderhit[4];} if (square == 36) {square=44; ++ladderhit[5];} if (square == 51) {square=67; ++ladderhit[6];} if (square == 71) {square=91; ++ladderhit[7];} if (square == 80) {square=100;++ladderhit[8];}/// so when 80 comes raech to our goal exit if (square == 98) {square=78; ++chutehit[0];} /** Chutes ? **/ if (square == 95) {square=75; ++chutehit[1];} if (square == 93) {square=73; ++chutehit[2];} if (square == 87) {square=24; ++chutehit[3];} if (square == 62) {square=19; ++chutehit[4];} if (square == 64) {square=60; ++chutehit[5];} if (square == 56) {square=53; ++chutehit[6];} if (square == 49) {square=11; ++chutehit[7];} if (square == 48) {square=26; ++chutehit[8];} if (square == 16) {square=6; ++chutehit[9];} } while (square100);//terminate if random no. is 100 printf(\n\n Game over after %d turns\n, turn); printf(\nSimulation complete... beginning statistical analysis...\n\n); printf(Total number of games played: %d \n, game); printf(Total number of turns: %f \n, RunningTurnTotal); average = RunningTurnTotal / game; printf(Avg number of turns per game: %f \n, average); printf(\n); ChuteStats(); printf(\n); ++game; printf(\n\n Would you like to run the simulation again? (1=Yes)...); scanf(%i,reply); if(reply==1)//e.g. reply==1 totalgames+=1; else exit(0);// exit } while (gametotalgames); getch(); } -- 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. Can you please write an algo for your program ? -- Siddharth Srivastava When you have learned to snatch the error code from the trap frame, it will be time for you to leave. -- 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: Amazon Question make confused !!!!!!!
Actually the solution is unique. The middle part with the Ys is the same and therefore can be omitted out. Now you are left with 2 equations and 2 unknowns. I used time in minutes and I have x = 1.28, z = 0.30476 units (y can be found out). I guess the trick was 1. to write the equations that Yan did and 2. to recognize that the plain part is the same and hence can be cancelled. On Sep 14, 3:31 am, Yan Wang wangyanadam1...@gmail.com wrote: actually, there are many solutions, just pick up one from them... On Tue, Sep 14, 2010 at 3:23 AM, Abhilasha jain mail2abhila...@gmail.com wrote: how can u solve 3 variables using 2 equations? On Tue, Sep 14, 2010 at 3:44 PM, Yan Wang wangyanadam1...@gmail.com wrote: x/72 + y/64 + z/56 = 4 x/56 + y/64 + z/72 = 4+2/3 find a solution to this ... On Tue, Sep 14, 2010 at 2:31 AM, bittu shashank7andr...@gmail.com wrote: Amazon Interview Question for Software Engineer / Developers A car has speed of 72 64 56 in downhill, plain and uphill respectively . A guy travels in the car from Pt. A to pt. B in 4 Hrs and pt. B to pt. A in 4 Hrs and 40 min. what is the distance between A and B? Regards Shashank -- 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. -- 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. -- 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. -- 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: Google Interview Question-Snake and Ladder Design
And please stop posting the same thing twice. It's been happening for the past couple of days at least. @Question: I think you can use graphs and flood fill algo for this. Every possible move can be represented with an edge. Flood fill will help you figure out possible moves from you current position. What do you think? On Sep 14, 2:51 am, ankur aggarwal ankur.mast@gmail.com wrote: @bittuu write your algo then code On Tue, Sep 14, 2010 at 1:36 PM, bittu shashank7andr...@gmail.com wrote: #includestdlib.h #includestdio.h #includemath.h #includeconio.h int turn, square; long game, totalgames; int seed; int chutehit[10], ladderhit[9]; float RunningTurnTotal; float average; char reply; void ChuteStats() {printf(Chute and Ladder Statistics:\n\n); printf(Chute0: %d Ladder0: %d\n, chutehit[0], ladderhit[0]); printf(Chute1: %d Ladder1: %d\n, chutehit[1], ladderhit[1]); printf(Chute2: %d Ladder2: %d\n, chutehit[2], ladderhit[2]); printf(Chute3: %d Ladder3: %d\n, chutehit[3], ladderhit[3]); printf(Chute4: %d Ladder4: %d\n, chutehit[4], ladderhit[4]); printf(Chute5: %d Ladder5: %d\n, chutehit[5], ladderhit[5]); printf(Chute6: %d Ladder6: %d\n, chutehit[6], ladderhit[6]); printf(Chute7: %d Ladder7: %d\n, chutehit[7], ladderhit[7]); printf(Chute8: %d Ladder8: %d\n, chutehit[8], ladderhit[8]); printf(Chute9: %d \n, chutehit[9]); } int main() { printf(Welcome to the Chutes and Ladders simulation \n); printf(...\n); srand(1); //printf(How many games would you like me to run? __ ); //scanf(%i,totalgames); ///printf(\n You have chosen to run %i games... thank you! \n, totalgames); totalgames+=2; RunningTurnTotal=0.0; game=1; do{ turn=0; square=0; /** Reset game **/ do /** Begin game loop **/ { ++turn; RunningTurnTotal = RunningTurnTotal + 1; square = square + 1 + rand()%6; /** Spin and move **/ printf(square =%d \n,square); if (square == 1) {square=23; ++ladderhit[0];} /** Ladders? **/ if (square == 4) {square=14; ++ladderhit[1];} if (square == 9) {square=31; ++ladderhit[2];} if (square == 21) {square=42; ++ladderhit[3];} if (square == 28) {square=84; ++ladderhit[4];} if (square == 36) {square=44; ++ladderhit[5];} if (square == 51) {square=67; ++ladderhit[6];} if (square == 71) {square=91; ++ladderhit[7];} if (square == 80) {square=100;++ladderhit[8];}/// so when 80 comes raech to our goal exit if (square == 98) {square=78; ++chutehit[0];} /** Chutes ? **/ if (square == 95) {square=75; ++chutehit[1];} if (square == 93) {square=73; ++chutehit[2];} if (square == 87) {square=24; ++chutehit[3];} if (square == 62) {square=19; ++chutehit[4];} if (square == 64) {square=60; ++chutehit[5];} if (square == 56) {square=53; ++chutehit[6];} if (square == 49) {square=11; ++chutehit[7];} if (square == 48) {square=26; ++chutehit[8];} if (square == 16) {square=6; ++chutehit[9];} } while (square100);//terminate if random no. is 100 printf(\n\n Game over after %d turns\n, turn); printf(\nSimulation complete... beginning statistical analysis...\n\n); printf(Total number of games played: %d \n, game); printf(Total number of turns: %f \n, RunningTurnTotal); average = RunningTurnTotal / game; printf(Avg number of turns per game: %f \n, average); printf(\n); ChuteStats(); printf(\n); ++game; printf(\n\n Would you like to run the simulation again? (1=Yes)...); scanf(%i,reply); if(reply==1)//e.g. reply==1 totalgames+=1; else exit(0);// exit } while (gametotalgames); getch(); } ///O(N^2) solution Does solution exits in O(n) or (nlogn)..? reply me sum1 git dis.. //i will post analysis of dsi program later i m solving usig OOPS (Java) to represnt everything as object //right me if i m wrong or hw we can improve dis alog. Regards Shashank Mani Don't Be Evil u Can Earn While U Learn BIT Mesra-2010 09166674831 -- 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
[algogeeks] Re: Write a program to arrange numbers from 1 to 16 such that the sum of two consecutive numbers is a perfect square
I guess the problem could be modified for any 1..n where n is 2^m. so say 132 or 1...64 Try it out. It still works! The time complexity in this case is O(log n). On Sep 14, 6:02 am, Dave dave_and_da...@juno.com wrote: @Bittu: First, it makes no sense to say O(n) when n is fixed. Second, if you know the solution, a program to print it out just consists of a printf statement, e.g., printf(16, 9, 7, 2, 14, 11, 5, 4, 12, 13, 3, 6, 10, 15, 1, 8\n); plus whatever language stuff you need to get it to compile and run. Dave On Sep 14, 4:26 am, bittu shashank7andr...@gmail.com wrote: @Davhw can u compute in contant time where runing time dwepends on elements of array e.g. its has complexcity O(n) isn'tit..?? import java.util.Arrays; import java.util.LinkedList; class SolutionFinder { public static void find(final LinkedListInteger remaining, final LinkedListInteger found) { if (remaining.size() == 0) // We made it through the whole list, this is a solution { for (final Integer curr : found) { System.out.printf(%d , curr);} } else { for (int i = 0; i remaining.size(); i++) { final Integer next = remaining.get(i); System.out.print(next \t + next); int size=found.size()-1; Integer fnd=found.get(size);//always return last System.out.print(\t fnd \t + fnd + \n); if (Arrays.asList(4, 9, 16, 25).contains(fnd+ next)) { found.add(remaining.remove(i)); find(remaining, found); remaining.add(i, found.remove(found.size() - 1)); } } } } public static void main(final String[] args) { final LinkedListInteger remaining = new LinkedListInteger(); final LinkedListInteger found = new LinkedListInteger(); for (int i = 1; i = 15; i++) { remaining.add(i);} found.add(16); find(remaining, found); } } Right me if i m wrong Regard's Shashank Mani Narayan Don't Be Evil U Can Earn While U learn Computer Science Engineering Birla Institute of Technology,Mesra Cell No. +91-9166674831 -- 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: Excellent Compilation of Interview Questions
for product companies like Microsoft, Google Adobe see http://www.rawkam.com/ On Sun, Sep 12, 2010 at 4:30 PM, aparichith vineelyalamar...@gmail.comwrote: Can any one tell me how to prepare for a good product development company with in 6 months time interval ? -- 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] Excellent Compilation of Interview Questions
Shame on you.. you have copied the articles as it is from other sites. For example, the article http://www.cracktheinterview.org/2010/08/converting-a-tree-to-a-doubly-linked-list/; is an exact copy-paste from rawkam.com. So much so that the images still point to images of rawkam.com On Sat, Sep 11, 2010 at 1:26 AM, Shashank Krishna sasan...@gmail.comwrote: Excellent Compilation of Interview Questions Visit http://www.cracktheinterview.org/ -- 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: Amazon Question make confused !!!!!!!
This isn't right. Dropping both y terms is the same as setting y to zero. The answer you get is correct, but there are many others as has been said. You could get a unique solution if the route were constrained to be monotonic (level and up or else level and down). On Sep 14, 4:28 pm, Minotauraus anike...@gmail.com wrote: Actually the solution is unique. The middle part with the Ys is the same and therefore can be omitted out. Now you are left with 2 equations and 2 unknowns. I used time in minutes and I have x = 1.28, z = 0.30476 units (y can be found out). I guess the trick was 1. to write the equations that Yan did and 2. to recognize that the plain part is the same and hence can be cancelled. On Sep 14, 3:31 am, Yan Wang wangyanadam1...@gmail.com wrote: actually, there are many solutions, just pick up one from them... On Tue, Sep 14, 2010 at 3:23 AM, Abhilasha jain mail2abhila...@gmail.com wrote: how can u solve 3 variables using 2 equations? On Tue, Sep 14, 2010 at 3:44 PM, Yan Wang wangyanadam1...@gmail.com wrote: x/72 + y/64 + z/56 = 4 x/56 + y/64 + z/72 = 4+2/3 find a solution to this ... On Tue, Sep 14, 2010 at 2:31 AM, bittu shashank7andr...@gmail.com wrote: Amazon Interview Question for Software Engineer / Developers A car has speed of 72 64 56 in downhill, plain and uphill respectively . A guy travels in the car from Pt. A to pt. B in 4 Hrs and pt. B to pt. A in 4 Hrs and 40 min. what is the distance between A and B? Regards Shashank -- 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. -- 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. -- 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.- 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.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Excellent Compilation of Interview Questions
haha...no one knows now what was the true source of that solutionlot of stuff on same kind of problem is lying on web on tons of web-sitesthe only change in sol i can observe mostly is change in variable names :) On Tue, Sep 14, 2010 at 10:55 PM, TurksHead Education turksheadeducat...@gmail.com wrote: Shame on you.. you have copied the articles as it is from other sites. For example, the article http://www.cracktheinterview.org/2010/08/converting-a-tree-to-a-doubly-linked-list/; is an exact copy-paste from rawkam.com. So much so that the images still point to images of rawkam.com On Sat, Sep 11, 2010 at 1:26 AM, Shashank Krishna sasan...@gmail.comwrote: Excellent Compilation of Interview Questions Visit http://www.cracktheinterview.org/ -- 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. -- Thanks Regards, Saurabh -- 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.