0

At Wikipedia we can find a description of DecreaseKey(). From my point of view, if we perform the operation of cutting the nodes or remarking them, it may take linear time complexity, depending on the height of the tree from which we are cutting subtrees off. However, in the conclusion we can read that:

The actual time to perform the cutting was O(k), therefore (again with a sufficiently large choice of c) the amortized running time is constant.

Where it is amortized to constant time? How? I don't understand, why it turns out to be constant, if I can see a linear dependency: the number of cut-off trees may be dependent on the height of the tree.

Question
  • 43
  • 7
  • How does the execution of `DecreaseKey()` change the height of the trees? – Scott Hunter Dec 28 '22 at 19:05
  • If you cut off a subtree, the height of a tree may change or am I wrong? Beside this, I don't write about change of height, why do you ask about it? – Question Dec 28 '22 at 19:15
  • "...depending on the height of the tree..." So as the trees get shorter, the cost goes down. – Scott Hunter Dec 28 '22 at 19:17
  • However, I still cannot see the linkage between shortening trees and conclusion that the amortized cost is constant – Question Dec 28 '22 at 19:24
  • What happens when all of the trees are individual nodes? – Scott Hunter Dec 28 '22 at 19:30
  • Ah yes, there the time of DecreaseKey() is constant. However, we have to find the node with the value to be decreased. I am still confused that it should have been also a problem in case of a node inside a tree. We don't take into account searching time, do we? Additionally, do we neglect the time needed for shortening the trees? Why? – Question Dec 28 '22 at 19:37
  • DecreaseKey is what you asked about. – Scott Hunter Dec 28 '22 at 19:39
  • Alright, but before we move to single nodes, we have to cut them off the trees. When we get individual nodes, we get constant time, but before shortening the tree, it is linear according to its height. How we take into account the time needed for shortening? Operations on full trees in the beginning still belong to DecreaseKey(), not only steps involving single nodes. – Question Dec 28 '22 at 21:53

0 Answers0