compiled with the same compiler and run on the same computer under the same conditions as much as possiblethe same amount of care should be taken in the programming effort devoted to each program to make the implementations "equally efficient in this senseall of the factors mentioned above should cancel out of the comparison because they apply to both algorithms equally if you truly wish to understand the running time of an algorithmthere are other factors that are more appropriate to consider than machine speedprogramming languagecompilerand so forth ideally we would measure the running time of the algorithm under standard benchmark conditions howeverwe have no way to calculate the running time reliably other than to run an implementation of the algorithm on some computer the only alternative is to use some other measure as surrogate for running time of primary consideration when estimating an algorithm' performance is the number of basic operations required by the algorithm to process an input of certain size the terms "basic operationsand "sizeare both rather vague and depend on the algorithm being analyzed size is often the number of inputs processed for examplewhen comparing sorting algorithmsthe size of the problem is typically measured by the number of records to be sorted basic operation must have the property that its time to complete does not depend on the particular values of its operands adding or comparing two integer variables are examples of basic operations in most programming languages summing the contents of an array containing integers is notbecause the cost depends on the value of ( the size of the inputexample consider simple algorithm to solve the problem of finding the largest value in an array of integers the algorithm looks at each integer in turnsaving the position of the largest value seen so far this algorithm is called the largest-value sequential search and is illustrated by the following function/return position of largest value in "astatic int largest(int[aint currlarge /holds largest element position for (int = < lengthi++/for each element if ( [currlargea[ ]/if [iis larger currlarge /remember its position return currlarge/return largest position herethe size of the problem is nthe number of integers stored in the basic operation is to compare an integer' value to that of the largest value