@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
<[email protected]>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 <[email protected]
> > wrote:
>
>> what is the initial value of length that u r passing??
>>
>> On Sun, Aug 28, 2011 at 6:47 PM, prashant thorat <
>> [email protected]> 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 <
>>> [email protected]> 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 [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected].
>>>> 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 [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Regards,
>> Kamakshi
>> [email protected]
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
Regards,
Kamakshi
[email protected]
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.