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 nodeways = 0 ; // initiallyStart( x,y, TRAVERSED){if(x is an element of TRAVERSED) // can be found using a loopreturn;store x in TRAVERSEDif(x==y){ways++; // ways is the variable that counts the valid path foundreturn;}if (x-1>=0) // moving left from current nodestart(x-1,y,TRAVERSED);if (x+1>=m*n) // moving right from current nodestart(x+1,y,TRAVERSED);if (x-n>=0) // moving up from current nodestart(x-n,y,TRAVERSED);if (x+n>=m*n) // moving down from current nodestart(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
-~----------~----~----~----~------~----~------~--~---