[algogeeks] Re: Help me with this problem

2006-06-17 Thread prashant bhargava
Could u plz explain how u r getting the answer 24 (for ur 2nd reply) ?? I really didn't understand.plz explainOn 6/17/06, Norbert <
[EMAIL PROTECTED]> wrote:There's another example if you use floating point arithmetic. N = 10,
M = 10, K = 4. Correct answer is 24, not 25On 6/17/06, Norbert <[EMAIL PROTECTED]> wrote:> Sorry, you're wrong. Consider board of size N = 1, M = 5 and K = 2.
> If you round down (N/K) then you have RESULT = 0. If you round up then> you have 5. Also wrong.>> On 6/17/06, prashant bhargava <[EMAIL PROTECTED]
> wrote:> > if the question is complete then the answer shd' be (N/K) * M bricks> >> > am i right??> >> >> >> > On 6/17/06, Norbert < 
[EMAIL PROTECTED]> wrote:> > >> >> > I'm unable to solve this problem correctly. Please help me:> >> > You have chess board of size N x M and a lot of bricks of size K x 1.
> > How many bricks can you place on this board (brick edges must be> > pallarel to board edges)> >> > Thanks for help> >> >> >> > Regards,
> > Prashant Bhargava> > ***--***--***--***--***--***--***> > Plz do visit> > www.hemantdesign.com/prashant> >  > >
> >>-- "I am extraordinarily patient, provided I get my own way in the end."Regards,Prashant Bhargava ***--***--***--***--***--***--***Plz do visit
www.hemantdesign.com/prashant

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/algogeeks  -~--~~~~--~~--~--~---


[algogeeks] Re: Help me with this problem

2006-06-17 Thread prashant bhargava
if the question is complete then the answer shd' be (N/K) * M bricksam i right??On 6/17/06, Norbert <
[EMAIL PROTECTED]> wrote:I'm unable to solve this problem correctly. Please help me:
You have chess board of size N x M and a lot of bricks of size K x 1.How many bricks can you place on this board (brick edges must bepallarel to board edges)Thanks for helpRegards,Prashant Bhargava ***--***--***--***--***--***--***Plz do visitwww.hemantdesign.com/prashant

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/algogeeks  -~--~~~~--~~--~--~---


[algogeeks] Re: Find the number of paths between two points on a grid

2006-04-06 Thread prashant bhargava
Can't understand man!!! can u explain and also does your formula take into account the position of starting and ending points or is it just about the corner points that u r talking abt

-- Smile, it's the second best thing you can do with your lips..
By the way...the First thing is ur KISS :-)Prashant Bhargava-- www.excogitation.tk  or 
www.hemantdesign.com/prashant 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/algogeeks  -~--~~~~--~~--~--~---


[algogeeks] Re: Find the number of paths between two points on a grid

2006-04-06 Thread prashant bhargava
missed the m*n in the last fnxn call in recursion area...PLZ CORRECT
 



No, it's definitely not going the right way..
 
i wonder if this can be done using that formula...
 
here's this algo i just thought.
 
Suppose u've got m horizontal lines and  n vertical and u give each of them an index value. i.e. a 3x2 grid would be like...
 ___!_(1)_! (2)___

 ___!_(3)_! (4)___

 ___!_(5)_! (6)___
  ! !
 
we start from node x to node y and the nodes we have traversed are stored in an array named TRAVERSED..the fnxn uses recursion and the algo can be said as a backtracking algo since it checks all the nodes in a particular path if already travelled it returns from that very node 

 
 
ways = 0 ; // initially
 
Start( x,y, TRAVERSED)
{
 
  if(x is an element of TRAVERSED)  // can be found using a loop 

 return;
 
 store x in TRAVERSED
 if(x==y)
  {
    
    ways++;    // ways is the variable that counts the valid path found
    return;
 }
 
 if (x-1>=0) // moving left from current node
 start(x-1,y,TRAVERSED);

 if (x+1>=m*n) // moving right from current node
 start(x+1,y,TRAVERSED);

 if (x-n>=0) // moving up from current node
 start(x-n,y,TRAVERSED);

 if (x+n>=m*n) // moving down from current node
 start(x+n,y,TRAVERSED);
 
}

 
 
 
 
 
 -- Smile, it's the second best thing you can do with your lips..By the way...the First thing is ur KISS :-)Prashant Bhargava-- 
www.excogitation.tk  or 
www.hemantdesign.com/prashant -- Smile, it's the second best thing you can do with your lips..
By the way...the First thing is ur KISS :-)Prashant Bhargava-- www.excogitation.tk  or www.hemantdesign.com/prashant
 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/algogeeks  -~--~~~~--~~--~--~---


[algogeeks] Re: Find the number of paths between two points on a grid

2006-04-06 Thread prashant bhargava

No, it's definitely not going the right way..
 
i wonder if this can be done using that formula...
 
here's this algo i just thought.
 
Suppose u've got m horizontal lines and  n vertical and u give each of them an index value. i.e. a 3x2 grid would be like...
 ___!_(1)_! (2)___

 ___!_(3)_! (4)___

 ___!_(5)_! (6)___
  ! !
 
we start from node x to node y and the nodes we have traversed are stored in an array named TRAVERSED..the fnxn uses recursion and the algo can be said as a backtracking algo since it checks all the nodes in a particular path if already travelled it returns from that very node

 
 
ways = 0 ; // initially
 
Start( x,y, TRAVERSED)
{
 
  if(x is an element of TRAVERSED)  // can be found using a loop 

 return;
 
 store x in TRAVERSED
 if(x==y)
  {
    
    ways++;    // ways is the variable that counts the valid path found
    return;
 }
 
 if (x-1>=0) // moving left from current node
 start(x-1,y,TRAVERSED);

 if (x+1>=m*n) // moving right from current node
 start(x+1,y,TRAVERSED);

 if (x-n>=0) // moving up from current node
 start(x-n,y,TRAVERSED);

 if (x+n>=0) // moving down from current node
 start(x+n,y,TRAVERSED);
 
}
 
 
 
 
 
 -- Smile, it's the second best thing you can do with your lips..By the way...the First thing is ur KISS :-)Prashant Bhargava-- 
www.excogitation.tk  or 
www.hemantdesign.com/prashant 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/algogeeks  -~--~~~~--~~--~--~---


[algogeeks] Re: Find the number of paths between two points on a grid

2006-04-05 Thread prashant bhargava
Hey Buddy,
   NxM grid means that n is the no. of horizontal line and M is the no. of vertical lines.
   for a single line n=1 and m=0 so formula is C(1,0)...this gives the output 1. 
On 4/6/06, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote: 
I am wondering how you get the formula.If you have n = 1 and m = 2 which is a single line with 2 points, there 
should be 1 path between the two node. But your formula gives 3.LeiBy the way...the First thing is ur KISS :-) Prashant Bhargava-- www.excogitation.tk  or 
www.hemantdesign.com/prashant 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/algogeeks  -~--~~~~--~~--~--~---