we can make a BST(Binary search tree) for this problem, suppose the path is
of length 10, and currently i am on 1st platform ,then this one should be in
our root node and children of this root would be 2 and 3...Similarly we
iterate until we find 10 in every leaves of BST.Then we can easily print all
the possible paths.

On Sun, Aug 28, 2011 at 7:47 PM, prashant thorat
<prashantnit...@gmail.com>wrote:

> yes, u are correct!! thanks
>
> On Sun, Aug 28, 2011 at 7:39 PM, Kamakshii Aggarwal <kamakshi...@gmail.com
> > wrote:
>
>> @prashant:
>> if u remove else from this line
>> else if(lenght+2 <= N)
>>     { Printf (" -->two steps -->") call printPath (length+2) }
>> i think then the code will work properly.
>> correct me if i am wrong
>> On Sun, Aug 28, 2011 at 7:01 PM, prashant thorat <
>> prashantnit...@gmail.com> wrote:
>>
>>> sorry, pls ignore above code ..a bit modifie code
>>>
>>> I'm passing length  = 0
>>>
>>>
>>> printPath (int length)
>>> {
>>>  if(lenght == N) return;
>>> else
>>> {
>>>   if(lenght+1 <= N)
>>>      { Printf (" -->one step -->") call printPath (length+1) }
>>>
>>>   else if(lenght+2 <= N)
>>>     { Printf (" -->two steps -->") call printPath (length+2) }
>>>
>>>   else
>>>    return;
>>> }
>>> On Sun, Aug 28, 2011 at 6:54 PM, Kamakshii Aggarwal <
>>> kamakshi...@gmail.com> wrote:
>>>
>>>> what is the initial value of length that u r passing??
>>>>
>>>> On Sun, Aug 28, 2011 at 6:47 PM, prashant thorat <
>>>> prashantnit...@gmail.com> wrote:
>>>>
>>>>> Hi, you can do this by recursion ,
>>>>>
>>>>> printPath (int length)
>>>>> {
>>>>>  if(lenght == N) return;
>>>>> else
>>>>> {
>>>>>   if(lenght+1 >= N)  { Printf (" -->one step -->") call printPath
>>>>> (length+1) }
>>>>>  else if(lenght+2 >= N)  { Printf (" -->two steps -->") call printPath
>>>>> (length+2) }
>>>>> else
>>>>> return;
>>>>>
>>>>> }
>>>>> }
>>>>> On Sun, Aug 28, 2011 at 5:42 PM, himanshu kansal <
>>>>> himanshukansal...@gmail.com> wrote:
>>>>>
>>>>>> you have a path of N steps....
>>>>>> at every step, you can take onl;y 1 step or 2 steps.....
>>>>>>
>>>>>> how to print all the possible paths that you can take......
>>>>>>
>>>>>> PS: please dont give the exact code.....your approaches will be
>>>>>> appreciated....:)
>>>>>>
>>>>>> --
>>>>>> 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.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Yours affectionately,
>>>>> Prashant Thorat
>>>>> Computer Science and Engg. Dept,
>>>>> NIT Durgapur.
>>>>>
>>>>>  --
>>>>> 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.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Kamakshi
>>>> kamakshi...@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.
>>>>
>>>
>>>
>>>
>>> --
>>> Yours affectionately,
>>> Prashant Thorat
>>> Computer Science and Engg. Dept,
>>> NIT Durgapur.
>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>> Regards,
>> Kamakshi
>> kamakshi...@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.
>>
>
>
>
> --
> Yours affectionately,
> Prashant Thorat
> Computer Science and Engg. Dept,
> NIT Durgapur.
>
>  --
> 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.
>



-- 
Mohit kumar lal
rit2009014
IIIT ALLAHABAD
contact@9454681805
kumarmohit...@gmail.com
mohitkumar...@yahoo.com
rit2009...@iiita.ac.in
http://profile.iiita.ac.in/rit2009014

-- 
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.

Reply via email to