You might wonder why I added a picture of a blue alien as my cover image. It's a character from one of my favourite movies "Home" and his name is O...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks for this article, those are good and easy examples!
Still, because you mentioned it, I wonder if I would just walk out the room if sometimes someone asks me about big O notation in a job interview.
Not because I don’t understand it, but because I’ve never needed it a single time in the last 20 years.
I once was asked to reduce the execution time of a MySQL procedure. That query could take between 2 to 3 minutes to execute using a recursion-ish call that could, at worst, make it an O(n^3). My solution was to change the data structure, which was very strange, to a JSON one and use the Generated Column feature, we could reduce to an O(n^2) for the procedure and the time was at the 10ms. The only drawback was a little increase in insertion time.
I don't think people say "hey look, this triple-loop through all the dataset is an O(n^3)", you just know something is wrong and go up to a better solution right away.
Last but not least, knowing the kind of task you want to do with the data, how it will be managed, grow and access can help you select the proper type of data structure, may it be a set, a queue, a stack, a linked list, etc.
It depends on the job though. I do Java backend transaction processing so our team always needs to understand a basic understanding of runtime (and memory usage) when we code. It's mostly basic things like why something is 'faster' then O(n2). Sometimes to reduce runtime, we cache, but then we have to consider the size of the cache, etc
That being said, for front-end web dev, I don't think I've ever had to ever think about it.
Yes, I think the key point is that after some good or bad experiences, most developers will have an implicit knowledge that helps deciding on how to program something and when something’s very slow to find out why.
That said, I’ve probably used it a lot of times. But I never wrote down or talked explicitly about O().
And by the way, I was a java Backend developer for most of my time and just recently started in the frontend as well.
I ask this to senior devs pretty frequently, about how often they use Big O. They respond like you. I asked because I still struggle with learning it.
I think about that time I build a reporting tool in python, and it took 50 seconds to compile the report. I was still learning, and the thing worked so :shrug:.
Now that I 'sort' of understand Big O- if I had to refactor that code, I'm more likely to think about performance and when to use specific loops/nested loops.
I still won't be able to go, "AH - that's a O(n log n)" or whatever. But that background understanding does change how I will approach the problem.
true :)
Awesome article, Sarah!
Thanks Friday
great article, sarah!
might i add, 'grokking algorithms by aditya bhargava' is a great resource for getting up to speed with big o notation and algorithms in general (when and which to use).
github repo containing algorithms in different languages from grokking's masterpiece: github.com/egonSchiele/grokking_al...
Thank you for this useful information. Just placed an order for the book. It's exactly what I needed.
Great overview, although re: O(n log n) it may be worth noting that complexity is the average time complexity for most sorting algorithms as best and worst can range from O(n) to O(n2) for many of them.
I rarely use big o notation, but it is solid knowledge to have since it makes us think about function complexity and the cost’ around things like disk io, or something silly like asking a html element about its dimensions.
In that context, i find it remarkably relevant.
Nice article! Thank you Sarah :D
Thank you Pablo
Thank you
Thanks For this article
Thanks for reading it. I'm glad you like it.
Could you give an example for O(n!) kind of felt like it wasn’t explained well enough..👍 for the rest of them :)
Very nice article, Sarah!
Thank you Bruno
A bit easier way to explain #BigONotation :)
twitter.com/dr_dimaka/status/11555...
LOL!
Immediately I saw the topic, Oh the Boov came to mind and I mentioned his name. Opening the link then seeing him gave me joy!😂😂. My best animation yet! Amazing helpful post! Learnt more.😊