How to determine the height of a recursion tree from a recurrence relation?

前端 未结 5 1108
刺人心
刺人心 2021-02-05 18:29

How does one go about determining the height of a recursion tree, built when dealing with recurrence run-times? How does it differ from determining the height of a regular tree

5条回答
  •  日久生厌
    2021-02-05 19:30

    If recurrence is in the form of T(n) = aT(n/b) + f(n) then the depth of the tree is log base b of n.

    For example, 2T(n/2) + n recurrence would have tree of depth lg(n) (log base 2 of n).

提交回复
热议问题