If the algorithm has two sub-algorithms, when it is the best case for sub-algorithm A1 for a given input, this is the worst case for sub-algorithm A2. How can I find the overall complexity of the algorithm? I just mean Ω (N) + O (N) =? I know if the algorithms are executed sequentially, across the complexity of O (N) + O (N) and in the nested order of O (N) * O (N).
Please tell me in both cases, when in a sequential and nested order
Essentially, Ω (N) + O (N) = Ω (N). Since O (N) means a lower (or nothing more) order Ω (N). When they are summed, the lower order can be omitted.
, () O (N), , O (N ^ 2), O (N ^ 2). , O (N ^ 2 + N). Ω(). " ".
N , O (N), O (N ^ 2). Ω(). , N. " ".