# Math Help - Big O for sequential algoritms

1. ## Big O for sequential algoritms

If an algoritm consists of for instance two sequential calculations with a given time complexity as below, what is the total complexity for the algo?

ALGO:
calculate_one() // O(n)
calculate_two() // O(n)

Time complexity for each is O(n), is it true that the total time complexity is O(n+n) = O(n) in worst case?

2. Originally Posted by avantimedev
If an algoritm consists of for instance two sequential calculations with a given time complexity as below, what is the total complexity for the algo?

ALGO:
calculate_one() // O(n)
calculate_two() // O(n)

Time complexity for each is O(n), is it true that the total time complexity is O(n+n) = O(n) in worst case?
The complexity is O(n) for whatever case conditions appy to the sub-calculations, if one is worst case then its worst case, if both are average case then its average case etc

CB

3. Yes. It follows from the definition of the big O notation.