Time Complextiy Basics
This is a kind of topic which most of the programmers find difficult dont worry in this blog it will made smooth as butter. Let's Get into It:
Time Complexity : The amount of time taken by code to run.
However, we need to remember that this is not dependent on your computer system rather it is dependent on the logic of your code otherwise no matter what your logic is still it would run fast than the best logic one since individual's computer is fast and quick.

These are the basic notations you need to follow there are more too like theta and omega but they fall under the category for best and average case while O(n) is for worst case time complexity which we take into consideration.
Worst Case Time Complexity : O(n)
We always take only this it basically means that code can run in less time than this but it won't take more than this now what time it will take it all depends on iteration.
Let's understand using example of Linear Search :

The above code is for linear search now lets understand it
if we have arr[] = {1,2,3,4,5,6} and key = 1
so when we will traverse we will get the key itself on first iteration so the time complexity of that will be O(1) which is also known as constant case now if in the same example if our key would have been 6 lets see:
arr[] = {1,2,3,4,5,6} and key = 6
so now we will get 6 after 6 iterations that means we need to traverse the array 6 times to find the key so it is the worst case so the time complexity in this case would be O(n) where n = number of iterations so here instead of writing O(6) we will write O(n).
We will talk more in detail in next blog till then keep exploring and comment the topic which you guys want and follow me on linkedin and instagram.
See u on next part of Time Complexity till then HAPPY READING!!!.