How to think in recursive way?

前端 未结 7 1078
逝去的感伤
逝去的感伤 2021-01-30 19:02

In order to understand the advanced algorithm concepts like greedy methods and dynamic programming, one first need to be well versed in recursion.

I am relatively new to

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-30 19:24

    Here is my simple test in Python:

    def p(l, index):
        if index == len(l):
            return
        else:
            print l[index]
            index = index + 1
            p(l, index)
    

    and call:

    p("123456", 0)
    

提交回复
热议问题