117k views
4 votes
What is the importance of big O notation in programming?.

User Bsquare
by
4.7k points

2 Answers

13 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 Ahmed HENTETI
by
5.0k points
9 votes
Its a mathematical notation that describes the limiting behavior of a function when the argument trends towards a particular value or infinity.
User Ben Combee
by
5.4k points