[Data Structure] Introduction Summary

Focus on summarizing the time complexity:

1. Concept

The frequency of a sentence refers to the repeated execution of the sentence in the algorithm frequency. The sum of the frequency of all sentences in the algorithm is recorded as T(n), which is a function of the problem scale n of the algorithm, and the time complexity mainly analyzes the order of magnitude of T(n). The frequency f(n) of the basic operations in the algorithm is usually used to analyze the time complexity of the algorithm. The time complexity of the algorithm is recorded as:

T(n)=O(f(n))

O represents the order of magnitude of T(n). It means that as the problem size n increases, the growth rate of the algorithm execution time is the same as the growth rate of f(n), which is called the progressive time complexity of the algorithm, or time complexity for short. Where f(n) is a certain function of the problem size n. In this way, O() is used to reflect the notation of algorithm time complexity, which we call Big O notation.

2. Calculation method

1) Replace all addition constants in the running time with a constant 1.

2) In the modified running count function, only the highest order items are retained.

3) If the highest-order term exists and is not 1, remove the constant multiplied by this term.

The result obtained is a big O order.

Note:

1) To analyze the complexity of the algorithm, the key is to analyze the operation of the loop structure.

2) Time spent in common time complexity:

O(1)

3) Generally, the time complexity we mentioned is the worst time complexity

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5062 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.