[algogeeks] Re: Google Interview Question-Snake and Ladder Design

2010-09-17 Thread vikas kumar
take this approach fill array of snakes starting position in snake[num_snake] for each snake[i] , take the end of snake and fill in some other array take random number gen and fill these arrays-- e.g. end_snake[i] = ran(start_snake[i]-10) // so that snake does not end up in same row same logic

Re: [algogeeks] Re: Google Interview Question-Snake and Ladder Design

2010-09-17 Thread Anil Kumar S. R.
@bittu, we are here to discuss the way to solve it. Posting a code here will not do anything good. Anil Kumar S. R. http://sranil.googlepages.com/ The best way to succeed in this world is to act on the advice you give to others. On 14 September 2010 13:33, bittu shashank7andr...@gmail.com

[algogeeks] Re: Google Interview Question-Snake and Ladder Design

2010-09-14 Thread bittu
#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],

Re: [algogeeks] Re: Google Interview Question-Snake and Ladder Design

2010-09-14 Thread siddharth srivastava
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

[algogeeks] Re: Google Interview Question-Snake and Ladder Design

2010-09-14 Thread Minotauraus
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