I have a treeort function that performs two different tasks, each with its own time complexity. I understood avg. the time complexity of two tasks, but how to find the overall complexity of the algorithm.
For example, the algorithm accepts a random list of "n" keys x:
Sort(x):
Insert(x):
Traverse(x):
I just add two difficulties together to give me O (n + nLog (n)), or I take the dominant task (in this case Insert) and end up with the overall complexity of O (nLog (n))
source
share