I have a question about complexity of combination two methods. Assume that I have method A with its complexity is $O(n)$ and second method that has complexity is $O(n^2)$. In which, n is number of elements that need resolve.
This is my problem: To resolve n elements, I must use two methods: 1 and 2. Assume that after use method 1, we can resolve $n_1$ elements in total of $n$ elements, so the complexity of first step is $O(n_1)$. The remaining unresolve is $(n-n_1)$. We must apply method 2, therefore, the complexity of second step is $O((n-n_1)^2)$
The total complexity is $O(n_1)+O((n-n_1)^2)$
Is it correct?
Note that: $n_1$ will be increasing when $n$ is large.