searching for occurrences of value each of the countindexand contains methods proceed through iteration of the sequence from left to right in factcode fragment of section demonstrates how those behaviors might be implemented notablythe loop for computing the count must proceed through the entire sequencewhile the loops for checking containment of an element or determining the index of an element immediately exit once they find the leftmost occurrence of the desired valueif one exists so while count always examines the elements of the sequenceindex and contains examine elements in the worst casebut may be faster empirical evidence can be found by setting data list(range( )and then comparing the relative efficiency of the test in datarelative to the test in dataor even the failed test- in data lexicographic comparisons comparisons between two sequences are defined lexicographically in the worst caseevaluating such condition requires an iteration taking time proportional to the length of the shorter of the two sequences (because when one sequence endsthe lexicographic result can be determinedhoweverin some cases the result of the test can be evaluated more efficiently for exampleif evaluating [ [ ]it is clear that the result is true without examining the remainders of those listsbecause the second element of the left operand is strictly less than the second element of the right operand creating new instances the final three behaviors in table are those that construct new instance based on one or more existing instances in all casesthe running time depends on the construction and initialization of the new resultand therefore the asymptotic behavior is proportional to the length of the result thereforewe find that slice data[ : can be constructed almost immediately because it has only eight elementswhile slice data[ : has one million elementsand thus is more time-consuming to create mutating behaviors the efficiency of the mutating behaviors of the list class are described in table the simplest of those behaviors has syntax data[jvaland is supported by the special setitem method this operation has worst-case ( running time because it simply replaces one element of list with new value no other elements are affected and the size of the underlying array does not change the more interesting behaviors to analyze are those that add or remove elements from the list