data structures using logarithmic loops we have seen that in linear loopsthe loop updation statement either adds or subtracts the loop-controlling variable howeverin logarithmic loopsthe loop-controlling variable is either multiplied or divided during each iteration of the loop for examplelook at the loops given belowfor( = ; < ; *= for( = ; >= ; /= statement blockstatement blockconsider the first for loop in which the loop-controlling variable is multiplied by the loop will be executed only times and not times because in each iteration the value of doubles nowconsider the second loop in which the loop-controlling variable is divided by in this case alsothe loop will be executed times thusthe number of iterations is function of the number by which the loop-controlling variable is divided or multiplied in the examples discussedit is that iswhen the number of iterations can be given by log which is approximately equal to thereforeputting this analysis in general termswe can conclude that the efficiency of loops in which iterations divide or multiply the loop-controlling variables can be given as (nlog nested loops loops that contain loops are known as nested loops in order to analyse nested loopswe need to determine the number of iterations each loop completes the total is then obtained as the product of the number of iterations in the inner loop and the number of iterations in the outer loop in this casewe analyse the efficiency of the algorithm based on whether it is linear logarithmicquadraticor dependent quadratic nested loop linear logarithmic loop consider the following code in which the loop-controlling variable of the inner loop is multiplied after each iteration the number of iterations in the inner loop is log this inner loop is controlled by an outer loop which iterates times thereforeaccording to the formulathe number of iterations for this code can be given as log for( = ; < ; ++for( = < ; *= statement blockin more general termsthe efficiency of such loops can be given as (nn log quadratic loop in quadratic loopthe number of iterations in the inner loop is equal to the number of iterations in the outer loop consider the following code in which the outer loop executes times and for each iteration of the outer loopthe inner loop also executes times thereforethe efficiency here is for( = ; < ; ++for( = < ; ++statement blockthe generalized formula for quadratic loop can be given as (nn dependent quadratic loop in dependent quadratic loopthe number of iterations in the inner loop is dependent on the outer loop consider the code given belowfor( = ; < ; ++for( = <= ; ++statement blockin this codethe inner loop will execute just once in the first iterationtwice in the second iterationthrice in the third iterationso on and so forth in this waythe number of iterations can be calculated as