338,088 views
38 votes
38 votes
What is the importance of big O notation in programming?.

User Tom Rudge
by
2.7k points

2 Answers

23 votes
23 votes

Answer:

Big O notation is a way to describe the efficiency of an algorithm in terms of the amount of time it takes to execute

Step-by-step explanation:

For instance, let's say you have to calculate the amount of time an algorithm takes. There are a couple possible solutions that may come to mind:

- Start a timer when the algorithm starts running, and stopping it once it finishes. While this might seem like a good approach to the problem, it has a few flaws. For once, the time it takes is affected by a couple of different factors, such as: any other processes that the computer is running that may slow it down, or the computer's internal clock and tick speed.

- Another much better solution would be to count the number of steps executed. This is what Big O notation does. Regardless of outside factors, the number of steps an algorithm has stays fixed.

User Gert Gottschalk
by
3.1k points
22 votes
22 votes
Its a mathematical notation that describes the limiting behavior of a function when the argument trends towards a particular value or infinity.
User Kasperoo
by
2.7k points