What is Amortized Time Complexity? - Dynamic Array

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ก.ย. 2024
  • Amortized time complexity analysis for an algorithm involves taking to total cost of operations in the algorithm over an extended period of time.
    Amortized cost is useful when the cost of operations in an algorithm vary as per the state of the underlying data structure or time. In these cases, the average cost over an extended period of time is usually lesser than worst case operation cost.
    We take the example of a dynamic array, in which the size of the array is doubled on overflow, and elements are inserted N times. We come to the conclusion that the overall time complexity should be O(N) amortized.
    Link to code:
    • What is Amortized Time...
    References:
    www.cs.cmu.edu/...
    www.cs.cornell....
    anh.cs.luc.edu...
    Time complexity explanation:
    • What is Time Complexit...
    Log explanation:
    • Why does log(N) appear...

ความคิดเห็น • 128