Reputation: 21
The time of extract min=O(logn)
bubble-sort=O(n)
Breath-first-search=O(n+E)
For example, if an algorithm runs in O(logn) + O(n) + O(n+E) or O(logn + n + E)(I'm confused), can I say that's an O(logn) overall time complexity of above algorithms?
What is correct?
Upvotes: 2
Views: 337
Reputation: 311188
The Big-O notation shows how (approximately) the runtime would grow when the size of the input grows. When adding complexities, you take the "worst" of them all. O(log(n)) is negligible compared to O(n+E), as is O(n). So, if you have an algorithm that combines all these parts, the overall complexity would be O(n + E).
Upvotes: 2