Re:Why You Should Always Use === and Other Bad Practices
by goldenkey on Sunday February 09, 2014 @07:06PM
(#7208156)
I made an assumption, you're making an assumption too. I'd agree that in any case where it would actually matters, you'd be doing a small amount of ops in the if statement. The complexity change will depend on what you were doing in the loop as compared to the speed of a single if statement. If it were a large amount of ops, then yes, it'd be a more minor difference.
[ Parent
| on HN ]
Re:Why You Should Always Use === and Other Bad Practices
by Dylan16807 on Sunday February 09, 2014 @07:11PM
(#7208179)
My point is that "O(2n)" is an extremely specific and misleading way to characterize 'extra conditional per iteration'. It doesn't matter what the actual percentage difference is.
Re:Why You Should Always Use === and Other Bad Practices
by goldenkey on Monday February 10, 2014 @02:16AM
(#7209607)
I agree, now what is the correct notation so we all can learn? :-)
Re:Why You Should Always Use === and Other Bad Practices
by Dylan16807 on Monday February 10, 2014 @02:18AM
(#7209608)
It's completely pointless to use such a notation here in lieu of description or benchmarks, but if you insist then use something like O(kn) vs. O((k+1)n)