Find the sum of 'n' natural number.( ***lots of things to revise here ***)

 1) 








=> Approach 1








We can ignore the constant time complexity as it does not vary with input.



=> Approach 2 





Order(1) means Order(constant)

*constant means if the input size varies, there is no change in the time complexity.



For each approach there is the best case, average case and worst case.

=>











=>












=>


Comments