How to estimate the complexity of sequential algorithm given that we know the complexity of each step? First case:
I was stumble upon a two step sequential algorithm where the big O complexity of each step is $O(N^9)$.
Second case:
Also if the algorithm have three steps where the complexity of step 1 is $O(N^2)$, the complexity of step 2 is $O(N^3)$ and the complexity of step 3 is $O(N^9)$
What would be the complexity of the first case and second case ?
In the first case, we have $O(n^9)+O(n^9)$ and according to it's summation properties we have $O(n^9)+O(n^9)=O(2n^9)=O(n^9)$.
For the second case, both $n^2$ and $n^3$ are smaller than $n^9$, so we have $O(n^2)+O(n^3)+O(n^9)=O(n^2+n^3+n^9)&lt;O(n^9+n^9+n^9)=O(3n^9)=O(n^9)$
In the general case, if we have time complexities $t_1,t_2,...,t_k$, then $O(t_1)+...+O(t_k)=O(max\{t_1,...,t_k\})$