Some Definitions for Time Complexity.
Give five symbolic and mathematical definitions related to time complexity.
Symbols and definitions
- Big O notation (): If , such that , , then .
- Small o symbol (): If , , such that , , then .
- Big Omega symbol (): If , such that , , then .
- Small omega symbol (): If , , such that , , then .
- Theta symbol (): If , such that , , then . It can be understood that when the complexity of the upper bound and the lower bound both increase by the same amount, then this complexity is also called a compact bound.
These notations describe the asymptotic behavior of algorithms' time complexity, aiding in understanding their performance characteristics.
Average, Best, Worst Cases
Time complexity is generally used to compare different algorithms, such as bubble sort, insertion sort, and heap sort. However, for the same algorithm, depending on the input, we can also consider average, best, and worst case time complexities. For example, the time complexity of a binary search tree varies between a singly linked list and a balanced tree.
Average Time Complexity: A measure of the weighted average of an algorithm's running time over all possible input cases. Let be the running time of the algorithm for an input size of . The average time complexity is defined as
where is the running time for the th input case, is the probability of the th case, and is the total number of possible input cases.
Best Case Time Complexity: The minimum running time required by an algorithm in the most ideal scenario.
Worst Case Time Complexity: The maximum running time required by an algorithm in the least ideal scenario.