SlideShare a Scribd company logo
1 of 4
Amortized Computational Complexity
Abstract : A powerful technique in the complexity analysis of various algorithms is amortization
or averaging over time. Amortized running time is a realistic measure of complexity of a
sequence of operations . It will not provide you with the exact computational time . Instead , it
lets you calculate a tight upper bound and lower bound of algorithms . Based on the result
obtained, varieties of algorithms can be compared for performance analysis . This white-paper
describes several methods of evaluating amortized complexity .
Introduction : In many uses of data structures , a sequence of operations , rather than a single
operation, is performed . So, the final goal is to evaluate the amortized time complexity of that
sequence . The only requirement is that the sum of the amortized complexity of all elements in
a sequence is greater than the sum of the actual complexities of the elements . So, we can
conclude :
Sum(amortized(i)) >= Sum(actual(i)) ........... (1.1)
Relative to actual cost and amortized cost of an operation in a sequence of n operations , we
define a potential function as below :
P(i) = amortized(i) - actual (i) - P(i-1) ...........(1.2)
Taking sum of the equation , we obtain :
P(n) = Sum(amortized(i)) - Sum(actual(i)) ..........(1.3)
From (1.1) & (1.3) , we conclude :
P(n) >= 0 ........(1.4)
To make the idea of amortization and motivation behind it more concrete , let us consider the
example of evaluating the amortized complexity of an algorithm , which displays number of toys
available in binary format . To update every digit of the display the algorithm takes d unit of
time . Assuming that the number of current toys is N and initial no. of toys is 0, we need to
evaluate the amortized complexity of the algorithm used to display the number of toys . There
are three popular methods to arrive at the amortized complexity of the operations, namely , (1)
aggregate method , (2) accounting method and (3) potential method .
Aggregate Method : In the aggregate method ,we determine the
UpperBoundOnSumOfActualCosts(N) for the sum of the actual costs of the n operations.The
amortized cost is amounted to UpperBoundOnSumOfActualCosts(N) /N .
Let N be the number of toys manufactured ; the number of digits used to display the number of
toys is n or 'Base-2 logN' . The least significant bit of the display has been changed N times ; the
second least significant bit changes once for every 2 toys ; the third least significant bit changes
once for every 4 times and so on...
So, the aggregate number of digits that have been changed is bounded by N (1+1/2+1/4+...)d or
d2N. So, the amortized cost is amounted to 2dN/N = 2d.
Accounting Method : To proceed using accounting method , we must first assign an amortized
cost and then prove that this assignment satisfies eq - (1.1). Generally we start by assigning an
amortized cost obtained by a good guess . Once we have shown this , we obtain an upper bound
on the cost of any operation sequence by computing Sum(f(i)*amortized(i)) , where f(i) be the
frequency of the operation and amortized(i) the amortized cost of the operation .
Suppose , we assign a guessed amortized cost of 2d for each display change . Then the potential
function
P(n) = Sum(amortized(i)) - Sum(actual(i))
= 2dN - d(1+1/2+1/4+.......)
> = 0;
So, the accounting method proved that the amortized cost of the display can be reduced to 2d.
Potential Method : In this approach , we postulate a function for the analysis and use the
function to satisfy eq - (1) .
Consider the example given in the introduction section . When the first toy is available , we can
use the amortized cost 2d to pay for the update , in which d amount is spent and remaining d
amount is retained as a credit to the first least significant bit. Following the update of the second
toy , the amount spent is 2d*2 in which 3d is spent to update two least significant digits and the
second least significant bit now has credit d and the first least significant bit has credit 0 .
Proceeding in this way , we can sum up credit on each digit of the display always equal (2d-d)v ,
where 2d be the amortized cost , d the actual cost and v the value of the digit. So, we should
use the potential function
P(N) = (2d-d)*Sum(v(i)) , where v(i) = digit value of the i-th digit
Let q be the number of 1’s at the rightmost places and the j th display and it has been changed
from jth to (j+1) th no.So, when the display changes from j th to j+1 th value, where j = 1111011
the potential change incurred
P(N) = d(1-q*1) ;
So the amortized cost for the display change = actual cost + p(N) = (q+1)d +P(N) = (q+1)d + d(1-
2*1) = 2d .
Conclusion : A worst case analysis ,in which we sum the worst-case time of individual
operations, may be unduly pessimistic ; it ignores correlated effect on data structures. On the
other hand, average case analysis can be inaccurate , as the probabilistic assumptions needed to
carry out the analysis may be false . In such a scenario, amortized analysis , in which we average
the running time over per operation , yield an answer that is both realistic and robust .

More Related Content

What's hot

Amortized analysis
Amortized analysisAmortized analysis
Amortized analysisajmalcs
 
Aoa amortized analysis
Aoa amortized analysisAoa amortized analysis
Aoa amortized analysisSalabat Khan
 
Amortized Analysis
Amortized Analysis Amortized Analysis
Amortized Analysis sathish sak
 
Adauctions
AdauctionsAdauctions
Adauctions超 刘
 
BIometrics- plotting DET and EER curve using Matlab
BIometrics- plotting DET and EER curve using MatlabBIometrics- plotting DET and EER curve using Matlab
BIometrics- plotting DET and EER curve using MatlabShiv Koppad
 
Synchronous Loadable Up and Down Counter
Synchronous Loadable Up and Down Counter Synchronous Loadable Up and Down Counter
Synchronous Loadable Up and Down Counter Digital System Design
 
Hw5 2017-spring
Hw5 2017-springHw5 2017-spring
Hw5 2017-spring奕安 陳
 
Solving a “Transportation Planning” Problem through the Programming Language “C”
Solving a “Transportation Planning” Problem through the Programming Language “C”Solving a “Transportation Planning” Problem through the Programming Language “C”
Solving a “Transportation Planning” Problem through the Programming Language “C”Shahadat Hossain Shakil
 
Dynamic Program Problems
Dynamic Program ProblemsDynamic Program Problems
Dynamic Program ProblemsRanjit Sasmal
 
Nrtl activity coefficient for mixture1
Nrtl activity coefficient for mixture1Nrtl activity coefficient for mixture1
Nrtl activity coefficient for mixture1ESSID Abou Hligha
 
ELECTRICAL POWER SYSTEMS ECONOMICS
ELECTRICAL POWER SYSTEMS ECONOMICSELECTRICAL POWER SYSTEMS ECONOMICS
ELECTRICAL POWER SYSTEMS ECONOMICSMohammedMedani4
 

What's hot (17)

Amortized analysis
Amortized analysisAmortized analysis
Amortized analysis
 
13 Amortized Analysis
13 Amortized Analysis13 Amortized Analysis
13 Amortized Analysis
 
Amortized
AmortizedAmortized
Amortized
 
Aoa amortized analysis
Aoa amortized analysisAoa amortized analysis
Aoa amortized analysis
 
Amortized Analysis
Amortized Analysis Amortized Analysis
Amortized Analysis
 
Adauctions
AdauctionsAdauctions
Adauctions
 
BIometrics- plotting DET and EER curve using Matlab
BIometrics- plotting DET and EER curve using MatlabBIometrics- plotting DET and EER curve using Matlab
BIometrics- plotting DET and EER curve using Matlab
 
Test
TestTest
Test
 
Synchronous Loadable Up and Down Counter
Synchronous Loadable Up and Down Counter Synchronous Loadable Up and Down Counter
Synchronous Loadable Up and Down Counter
 
Hw5 2017-spring
Hw5 2017-springHw5 2017-spring
Hw5 2017-spring
 
Amortized analysis
Amortized analysisAmortized analysis
Amortized analysis
 
Solving a “Transportation Planning” Problem through the Programming Language “C”
Solving a “Transportation Planning” Problem through the Programming Language “C”Solving a “Transportation Planning” Problem through the Programming Language “C”
Solving a “Transportation Planning” Problem through the Programming Language “C”
 
Dynamic Program Problems
Dynamic Program ProblemsDynamic Program Problems
Dynamic Program Problems
 
Chapter10 noha2012
Chapter10 noha2012Chapter10 noha2012
Chapter10 noha2012
 
A star
A starA star
A star
 
Nrtl activity coefficient for mixture1
Nrtl activity coefficient for mixture1Nrtl activity coefficient for mixture1
Nrtl activity coefficient for mixture1
 
ELECTRICAL POWER SYSTEMS ECONOMICS
ELECTRICAL POWER SYSTEMS ECONOMICSELECTRICAL POWER SYSTEMS ECONOMICS
ELECTRICAL POWER SYSTEMS ECONOMICS
 

Viewers also liked

Perpres 1072012 bppt
Perpres 1072012  bppt Perpres 1072012  bppt
Perpres 1072012 bppt riyanto st mt
 
Efc final test
Efc final testEfc final test
Efc final testNoeun Kruy
 
Scottish Enterprise Training Confirmation Letter
Scottish Enterprise Training Confirmation LetterScottish Enterprise Training Confirmation Letter
Scottish Enterprise Training Confirmation LetterAbi Riva
 
Desarrollo de los adolescentes i aspectos generales (1)
Desarrollo de los adolescentes i aspectos generales (1)Desarrollo de los adolescentes i aspectos generales (1)
Desarrollo de los adolescentes i aspectos generales (1)ookj
 
Way Improved :) GC Tuning Confessions - presented at JavaOne2015
Way Improved :) GC Tuning Confessions - presented at JavaOne2015Way Improved :) GC Tuning Confessions - presented at JavaOne2015
Way Improved :) GC Tuning Confessions - presented at JavaOne2015Monica Beckwith
 
Issue 10 NTEU Chapter_164_newsletter
Issue 10 NTEU Chapter_164_newsletterIssue 10 NTEU Chapter_164_newsletter
Issue 10 NTEU Chapter_164_newsletterNTEU Chapter 164
 
G1 collector and tuning and Cassandra
G1 collector and tuning and CassandraG1 collector and tuning and Cassandra
G1 collector and tuning and CassandraChris Lohfink
 
Prince 2 Certificate
Prince 2 CertificatePrince 2 Certificate
Prince 2 CertificateHeidi Best
 
Letter of Endorsement Sample
Letter of Endorsement SampleLetter of Endorsement Sample
Letter of Endorsement SampleMinhas Kamal
 

Viewers also liked (17)

Ffew
FfewFfew
Ffew
 
Presentacion diapositivas
Presentacion diapositivasPresentacion diapositivas
Presentacion diapositivas
 
1
11
1
 
Perpres 1072012 bppt
Perpres 1072012  bppt Perpres 1072012  bppt
Perpres 1072012 bppt
 
narendra new cv(1)
narendra new cv(1)narendra new cv(1)
narendra new cv(1)
 
Efc final test
Efc final testEfc final test
Efc final test
 
PRINCE2 FOUNDATION CERTIFICATE
PRINCE2 FOUNDATION CERTIFICATEPRINCE2 FOUNDATION CERTIFICATE
PRINCE2 FOUNDATION CERTIFICATE
 
Scottish Enterprise Training Confirmation Letter
Scottish Enterprise Training Confirmation LetterScottish Enterprise Training Confirmation Letter
Scottish Enterprise Training Confirmation Letter
 
PRINCE2 Foundation Certificate
PRINCE2 Foundation CertificatePRINCE2 Foundation Certificate
PRINCE2 Foundation Certificate
 
Desarrollo de los adolescentes i aspectos generales (1)
Desarrollo de los adolescentes i aspectos generales (1)Desarrollo de los adolescentes i aspectos generales (1)
Desarrollo de los adolescentes i aspectos generales (1)
 
Way Improved :) GC Tuning Confessions - presented at JavaOne2015
Way Improved :) GC Tuning Confessions - presented at JavaOne2015Way Improved :) GC Tuning Confessions - presented at JavaOne2015
Way Improved :) GC Tuning Confessions - presented at JavaOne2015
 
Issue 10 NTEU Chapter_164_newsletter
Issue 10 NTEU Chapter_164_newsletterIssue 10 NTEU Chapter_164_newsletter
Issue 10 NTEU Chapter_164_newsletter
 
G1 collector and tuning and Cassandra
G1 collector and tuning and CassandraG1 collector and tuning and Cassandra
G1 collector and tuning and Cassandra
 
Prince 2 Certificate
Prince 2 CertificatePrince 2 Certificate
Prince 2 Certificate
 
Career talk
Career talkCareer talk
Career talk
 
The Next Generation PMO - VIC
The Next Generation PMO - VICThe Next Generation PMO - VIC
The Next Generation PMO - VIC
 
Letter of Endorsement Sample
Letter of Endorsement SampleLetter of Endorsement Sample
Letter of Endorsement Sample
 

Similar to Amortized complexity

Amortized complexity
Amortized complexityAmortized complexity
Amortized complexityparamita30
 
DOC-20230417-WA0013.-7-27.pptx
DOC-20230417-WA0013.-7-27.pptxDOC-20230417-WA0013.-7-27.pptx
DOC-20230417-WA0013.-7-27.pptx03Shrishti
 
5.2 Least Squares Linear Regression.pptx
5.2  Least Squares Linear Regression.pptx5.2  Least Squares Linear Regression.pptx
5.2 Least Squares Linear Regression.pptxMaiEllahham1
 
Cs6402 daa-2 marks set 1
Cs6402 daa-2 marks set 1Cs6402 daa-2 marks set 1
Cs6402 daa-2 marks set 1Vai Jayanthi
 
Basic Computer Engineering Unit II as per RGPV Syllabus
Basic Computer Engineering Unit II as per RGPV SyllabusBasic Computer Engineering Unit II as per RGPV Syllabus
Basic Computer Engineering Unit II as per RGPV SyllabusNANDINI SHARMA
 
International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)IJERD Editor
 
economic load dispatch and unit commitment power_system_operation.pdf
economic load dispatch and unit commitment power_system_operation.pdfeconomic load dispatch and unit commitment power_system_operation.pdf
economic load dispatch and unit commitment power_system_operation.pdfArnabChakraborty499766
 
Asymptotic Analysis in Data Structure using C
Asymptotic Analysis in Data Structure using CAsymptotic Analysis in Data Structure using C
Asymptotic Analysis in Data Structure using CMeghaj Mallick
 
Lec03 04-time complexity
Lec03 04-time complexityLec03 04-time complexity
Lec03 04-time complexityAbbas Ali
 
Unit i basic concepts of algorithms
Unit i basic concepts of algorithmsUnit i basic concepts of algorithms
Unit i basic concepts of algorithmssangeetha s
 
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...
DSA Complexity.pptx   What is Complexity Analysis? What is the need for Compl...DSA Complexity.pptx   What is Complexity Analysis? What is the need for Compl...
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...2022cspaawan12556
 
Dynamic programming1
Dynamic programming1Dynamic programming1
Dynamic programming1debolina13
 
Ch-2 final exam documet compler design elements
Ch-2 final exam documet compler design elementsCh-2 final exam documet compler design elements
Ch-2 final exam documet compler design elementsMAHERMOHAMED27
 
TIME EXECUTION OF DIFFERENT SORTED ALGORITHMS
TIME EXECUTION   OF  DIFFERENT SORTED ALGORITHMSTIME EXECUTION   OF  DIFFERENT SORTED ALGORITHMS
TIME EXECUTION OF DIFFERENT SORTED ALGORITHMSTanya Makkar
 
WVKULAK13_submission_14
WVKULAK13_submission_14WVKULAK13_submission_14
WVKULAK13_submission_14Max De Koninck
 

Similar to Amortized complexity (20)

Amortized complexity
Amortized complexityAmortized complexity
Amortized complexity
 
DOC-20230417-WA0013.-7-27.pptx
DOC-20230417-WA0013.-7-27.pptxDOC-20230417-WA0013.-7-27.pptx
DOC-20230417-WA0013.-7-27.pptx
 
5.2 Least Squares Linear Regression.pptx
5.2  Least Squares Linear Regression.pptx5.2  Least Squares Linear Regression.pptx
5.2 Least Squares Linear Regression.pptx
 
Bellmon Ford Algorithm
Bellmon Ford AlgorithmBellmon Ford Algorithm
Bellmon Ford Algorithm
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
 
Cs6402 daa-2 marks set 1
Cs6402 daa-2 marks set 1Cs6402 daa-2 marks set 1
Cs6402 daa-2 marks set 1
 
Basic Computer Engineering Unit II as per RGPV Syllabus
Basic Computer Engineering Unit II as per RGPV SyllabusBasic Computer Engineering Unit II as per RGPV Syllabus
Basic Computer Engineering Unit II as per RGPV Syllabus
 
International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)
 
economic load dispatch and unit commitment power_system_operation.pdf
economic load dispatch and unit commitment power_system_operation.pdfeconomic load dispatch and unit commitment power_system_operation.pdf
economic load dispatch and unit commitment power_system_operation.pdf
 
Asymptotic Analysis in Data Structure using C
Asymptotic Analysis in Data Structure using CAsymptotic Analysis in Data Structure using C
Asymptotic Analysis in Data Structure using C
 
Lec03 04-time complexity
Lec03 04-time complexityLec03 04-time complexity
Lec03 04-time complexity
 
Unit i basic concepts of algorithms
Unit i basic concepts of algorithmsUnit i basic concepts of algorithms
Unit i basic concepts of algorithms
 
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...
DSA Complexity.pptx   What is Complexity Analysis? What is the need for Compl...DSA Complexity.pptx   What is Complexity Analysis? What is the need for Compl...
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...
 
Dynamic programming1
Dynamic programming1Dynamic programming1
Dynamic programming1
 
algo_vc_lecture8.ppt
algo_vc_lecture8.pptalgo_vc_lecture8.ppt
algo_vc_lecture8.ppt
 
Ch-2 final exam documet compler design elements
Ch-2 final exam documet compler design elementsCh-2 final exam documet compler design elements
Ch-2 final exam documet compler design elements
 
Big Oh.ppt
Big Oh.pptBig Oh.ppt
Big Oh.ppt
 
TIME EXECUTION OF DIFFERENT SORTED ALGORITHMS
TIME EXECUTION   OF  DIFFERENT SORTED ALGORITHMSTIME EXECUTION   OF  DIFFERENT SORTED ALGORITHMS
TIME EXECUTION OF DIFFERENT SORTED ALGORITHMS
 
WVKULAK13_submission_14
WVKULAK13_submission_14WVKULAK13_submission_14
WVKULAK13_submission_14
 
Slide2
Slide2Slide2
Slide2
 

Recently uploaded

UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...ranjana rawat
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 

Recently uploaded (20)

UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 

Amortized complexity

  • 1. Amortized Computational Complexity Abstract : A powerful technique in the complexity analysis of various algorithms is amortization or averaging over time. Amortized running time is a realistic measure of complexity of a sequence of operations . It will not provide you with the exact computational time . Instead , it lets you calculate a tight upper bound and lower bound of algorithms . Based on the result obtained, varieties of algorithms can be compared for performance analysis . This white-paper describes several methods of evaluating amortized complexity . Introduction : In many uses of data structures , a sequence of operations , rather than a single operation, is performed . So, the final goal is to evaluate the amortized time complexity of that sequence . The only requirement is that the sum of the amortized complexity of all elements in a sequence is greater than the sum of the actual complexities of the elements . So, we can conclude : Sum(amortized(i)) >= Sum(actual(i)) ........... (1.1) Relative to actual cost and amortized cost of an operation in a sequence of n operations , we define a potential function as below : P(i) = amortized(i) - actual (i) - P(i-1) ...........(1.2) Taking sum of the equation , we obtain : P(n) = Sum(amortized(i)) - Sum(actual(i)) ..........(1.3) From (1.1) & (1.3) , we conclude : P(n) >= 0 ........(1.4) To make the idea of amortization and motivation behind it more concrete , let us consider the example of evaluating the amortized complexity of an algorithm , which displays number of toys available in binary format . To update every digit of the display the algorithm takes d unit of time . Assuming that the number of current toys is N and initial no. of toys is 0, we need to evaluate the amortized complexity of the algorithm used to display the number of toys . There are three popular methods to arrive at the amortized complexity of the operations, namely , (1) aggregate method , (2) accounting method and (3) potential method .
  • 2. Aggregate Method : In the aggregate method ,we determine the UpperBoundOnSumOfActualCosts(N) for the sum of the actual costs of the n operations.The amortized cost is amounted to UpperBoundOnSumOfActualCosts(N) /N . Let N be the number of toys manufactured ; the number of digits used to display the number of toys is n or 'Base-2 logN' . The least significant bit of the display has been changed N times ; the second least significant bit changes once for every 2 toys ; the third least significant bit changes once for every 4 times and so on... So, the aggregate number of digits that have been changed is bounded by N (1+1/2+1/4+...)d or d2N. So, the amortized cost is amounted to 2dN/N = 2d. Accounting Method : To proceed using accounting method , we must first assign an amortized cost and then prove that this assignment satisfies eq - (1.1). Generally we start by assigning an amortized cost obtained by a good guess . Once we have shown this , we obtain an upper bound on the cost of any operation sequence by computing Sum(f(i)*amortized(i)) , where f(i) be the frequency of the operation and amortized(i) the amortized cost of the operation . Suppose , we assign a guessed amortized cost of 2d for each display change . Then the potential function P(n) = Sum(amortized(i)) - Sum(actual(i)) = 2dN - d(1+1/2+1/4+.......) > = 0; So, the accounting method proved that the amortized cost of the display can be reduced to 2d.
  • 3. Potential Method : In this approach , we postulate a function for the analysis and use the function to satisfy eq - (1) . Consider the example given in the introduction section . When the first toy is available , we can use the amortized cost 2d to pay for the update , in which d amount is spent and remaining d amount is retained as a credit to the first least significant bit. Following the update of the second toy , the amount spent is 2d*2 in which 3d is spent to update two least significant digits and the second least significant bit now has credit d and the first least significant bit has credit 0 . Proceeding in this way , we can sum up credit on each digit of the display always equal (2d-d)v , where 2d be the amortized cost , d the actual cost and v the value of the digit. So, we should use the potential function P(N) = (2d-d)*Sum(v(i)) , where v(i) = digit value of the i-th digit Let q be the number of 1’s at the rightmost places and the j th display and it has been changed from jth to (j+1) th no.So, when the display changes from j th to j+1 th value, where j = 1111011 the potential change incurred P(N) = d(1-q*1) ; So the amortized cost for the display change = actual cost + p(N) = (q+1)d +P(N) = (q+1)d + d(1- 2*1) = 2d .
  • 4. Conclusion : A worst case analysis ,in which we sum the worst-case time of individual operations, may be unduly pessimistic ; it ignores correlated effect on data structures. On the other hand, average case analysis can be inaccurate , as the probabilistic assumptions needed to carry out the analysis may be false . In such a scenario, amortized analysis , in which we average the running time over per operation , yield an answer that is both realistic and robust .