+ 6

Big "O" notation...

How often do you consider Big O when writing your programs? Does it even matter as long as the solution works?

28th Aug 2017, 8:03 PM
AGMeteor✔
AGMeteor✔ - avatar
6 ответов
+ 11
It matters if you care about performance. If I have an idea of how to write a program what I focus on is: what's the most optimital solution¿ That includes making something work. Algorithms that are O(n^4) or even O(n^3) are usually impractical.
28th Aug 2017, 9:12 PM
Rrestoring faith
Rrestoring faith - avatar
+ 6
I will do a quick Big O calculation after every loop I write, it's just so useful. If you can get that O(n²) down to a O(n log n) that makes a huge difference if you're processing as little as 1000 things.
28th Aug 2017, 11:17 PM
Schindlabua
Schindlabua - avatar
+ 4
Usually big o is taken in consideration when u r a hardcore devloped and developing a huge code or application but we should practice big o to the best case so we get habituated to it but never did this😂😂
29th Aug 2017, 5:02 PM
Aditya
Aditya - avatar
+ 2
Thank you for the answers... the reason I actually asked was I noticed sololearn playgrounds put time limits on some loops I wrote... like in "super perfect number challenge", some people's code could do calculations for a bigger range of numbers and mine a smaller one...
29th Aug 2017, 6:32 AM
AGMeteor✔
AGMeteor✔ - avatar
+ 2
I don't actually sit down and calculate it but I usually think about the effects of loops within loops and being in efficient when writing real world code. Like, "how bug can this input size get" or "what would be the effect of a really large input to this" and "is there a more efficient way"
29th Aug 2017, 3:10 PM
Vikram Singh
Vikram Singh - avatar
0
Big O notation is very useful when you choose a collection. For example search perfomance for an element is linear for array/list but a constant for dictionary/hashset
29th Aug 2017, 7:44 PM
Сергей Никомаров
Сергей Никомаров - avatar