Constant Amortized Time

后端 未结 6 1181
太阳男子
太阳男子 2020-11-22 01:44

What is meant by \"Constant Amortized Time\" when talking about time complexity of an algorithm?

6条回答
  •  爱一瞬间的悲伤
    2020-11-22 02:04

    The performance of any function can be averaged out by dividing the "total number of function calls" into the "total time taken for all those calls made". Even functions that take longer and longer for each call you do can be averaged out in this way.

    So, the essence of a function that performs at Constant Amortized Time is that this "average time" reaches a ceiling that does not get exceeded as the number of calls continues to be increased. Any particular call may vary in performance, but over the long run this average time won't keep growing bigger and bigger.

    This is the essential merit of something that performs at Constant Amortized Time.

提交回复
热议问题