Amortized Cost of Meld Operation

Data Structure AlgorithmsAnalysis of AlgorithmsAlgorithms

Calculating the amortized cost of meld operation is a difficult task. The major difficulty is in accumulating for the wide variations in the costs of an operation performed at different points in a random sequence of operations. Although our design goal is affected by the costs of sequence of operations, defining the notion of amortized cost of an operation in terms of the costs of sequences of operations leads nothing. Implementing a potential function to off set the variations in the actual costs is a perfect way of handling the situation.In the next topic we discuss the notion of amortized cost.

Let B be an Abstract data type(ADT) with basic operations P = {P1, P2,……, Pk} and let DS be a data structure implementing B. Let F be a potential function specified on the configurations of the data structures to non-negative real number. Let further that F(Φ) = 0. Let DSj specify a configuration we obtain if we perform an operation Pk on a configuration DS and let C denote the actual cost of performing Pk on DS.

Then, the amortized cost of Pk operating on DS, denoted as a(Pk, DS), is given by

a(Pk, DS) = C + F(DSj) – F (DS)

If a(Pk, DS)≤ cjg(m) for all configuration DS of size m, then we conclude that the amortized cost of Pk is O(g(m)).

raja
Published on 02-Jan-2020 07:05:29
Advertisements