Method
The method requires knowledge of which series of operations are possible. This is most commonly the case with data structures, which have state that persists between operations. The basic idea is that a worst case operation can alter the state in such a way that the worst case cannot occur again for a long time, thus "amortizing" its cost.
There are generally three methods for performing amortized analysis: the aggregate method, the accounting method, and the potential method. All of these give the same answers, and their usage difference is primarily circumstantial and due to individual preference.
- Aggregate analysis determines the upper bound T(n) on the total cost of a sequence of n operations, then calculates the amortized cost to be T(n) / n.
- The accounting method determines the individual cost of each operation, combining its immediate execution time and its influence on the running time of future operations. Usually, many short-running operations accumulate a "debt" of unfavorable state in small increments, while rare long-running operations decrease it drastically.
- The potential method is like the accounting method, but overcharges operations early to compensate for undercharges later.
Read more about this topic: Amortized Analysis
Famous quotes containing the word method:
“The country needs and, unless I mistake its temper, the country demands bold, persistent experimentation. It is common sense to take a method and try it. If it fails, admit it frankly and try another. But above all, try something. The millions who are in want will not stand idly by silently forever while the things to satisfy their needs are within easy reach.”
—Franklin D. Roosevelt (18821945)
“Women are denied masturbation even more severely than men and thats another method of controltheyre not taught to please themselves.... Most womenit takes them a while to warm up to the situation but once they get into it, Im sure theyre going to get just as hooked aswell, everyone I know is!”
—Lydia Lunch (b. 1959)
“I am not afraid of the priests in the long-run. Scientific method is the white ant which will slowly but surely destroy their fortifications. And the importance of scientific method in modern practical lifealways growing and increasingis the guarantee for the gradual emancipation of the ignorant upper and lower classes, the former of whom especially are the strength of the priests.”
—Thomas Henry Huxley (182595)