Calculation of algorithm time complexity

Time complexity calculation rules :

①Basic operation, consider its time complexity to be O(1) # Addition, subtraction, multiplication and division and other similar operations

②Sequential structure, time complexity is calculated by addition

③Circular structure, time complexity is calculated by multiplication

④Branch structure, maximum time complexity

⑤When judging the efficiency of an algorithm, it is often only necessary to pay attention to the highest order item of the number of operations , and other minor items and constant items can be ignored

⑥In the absence of special instructions, the time complexity of the algorithms we analyzed refers to the worst time complexity

 

 

      

 

    

 

     

 

     

 

     

Guess you like

Origin blog.csdn.net/qq_39197555/article/details/113256445