Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Possible Duplicate:
Plain English explanation of Big O

I've seen some questions here and on SO talking about the most efficient way to find or sort this or that. The questions usually talk about the efficiency of a certain algorithms in terms of O(...). As a wannabe-programmer, I would like to start learning how to program algorithmically.

So, what is O(...)? How do I calculate it, where can I learn about this?

share|improve this question

closed as not a real question by Mark Trapp Jan 29 '12 at 7:53

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

Have you looked at the Wikipedia article on time complexity? –  PersonalNexus Jan 29 '12 at 6:42
Ideally, you would do some basic research (such as looking at the relevant Wikipedia article) and only then ask about specific things that aren't clear here. A basic question such as "what is big O notation" isn't really a good fit for the Stack Exchange Q&A format. –  PersonalNexus Jan 29 '12 at 6:47
@PersonalNexus, I didn't know what it was called, so I didn't know how to search for it. –  mowwwalker Jan 29 '12 at 6:48
Hi user828584, as PersonalNexus mentions, this is a bit too broad for the Stack Exchange format: not sure what search terms you were trying, but Big O notation was the first hit when I searched for "o algorithm". Feel free to come back if you have any specific questions about the subject. –  user8 Jan 29 '12 at 7:55

1 Answer 1

up vote 5 down vote accepted

The O(...) refers to Big-O notation, which is a simple way of describing how many operations an algorithm takes to do something.

In Big-O notation, the cost of an algorithm is represented by its most costly operation at large numbers. If an algorithm took n^3 + n^2 + n steps, it would be represented O(N^3). An algorithm that counted each item in a list would operate in O(N) time, called linear time.

For a list of the names http://en.wikipedia.org/wiki/Big_O_notation#Orders_of_common_functions

If you would like to learn more, a free course from Stanford is being offered on Algorithms in February.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.