python data structures efficiency of an algorithm can be analysed at two different stagesbefore implementation and after implementation they are as followsa priori analysis this is theoretical analysis of an algorithm efficiency of an algorithm is measured by assuming that all other factorsfor exampleprocessor speedare constant and have no effect on the implementation posterior analysis this is an empirical analysis of an algorithm the selected algorithm is implemented using programming language this is then executed on target computer machine in this analysisactual statistics like running time and space requiredare collected algorithm complexity suppose is an algorithm and is the size of input datathe time and space used by the algorithm are the two main factorswhich decide the efficiency of time factor time is measured by counting the number of key operations such as comparisons in the sorting algorithm space factor space is measured by counting the maximum memory space required by the algorithm the complexity of an algorithm (ngives the running time and/or the storage space required by the algorithm in terms of as the size of input data space complexity space complexity of an algorithm represents the amount of memory space required by the algorithm in its life cycle the space required by an algorithm is equal to the sum of the following two componentsa fixed part that is space required to store certain data and variablesthat are independent of the size of the problem for examplesimple variables and constants usedprogram sizeetc variable part is space required by variableswhose size depends on the size of the problem for exampledynamic memory allocationrecursion stack spaceetc space complexity (pof any algorithm is (pc sp( )where is the fixed part and (iis the variable part of the algorithmwhich depends on instance characteristic following is simple example that tries to explain the concept algorithmsum(ab