mic and linear complexity. It is typical of some smart algorithms used to order
most of them.
input case.
CHAPTER 2
Considering Algorithm Design
41
»
Quadratic complexity O(n
2
): Operations grow as
a square of the number of
inputs. When you have one iteration inside another iteration (nested itera-
tions, in computer science), you have quadratic complexity. For instance, you
have a list of names and, in order to find the most similar ones, you compare
each name against all the other names. Some less efficient ordering algo-
rithms present such complexity: bubble sort, selection sort, and insertion sort.
This level of complexity means that your algorithms may run for hours or
even days before reaching a solution.
Do'stlaringiz bilan baham: