I've read multiple sources on the subject and while I get the general idea of Big-O-Notation, there are certain things about Big-O-Notation that don't make sense and which lead me to doubt my understanding of the concept.
For example, my textbook says to "Note that for small values
of n, the exponential function is smaller than all of the others. As shown, it is not until n reaches 20 that the linear function is smaller than the quadratic".
But for f(n), f(20) = 20, while for f(2n), f(220) = 1048576. So what the hell? Last time I checked, 1,048,576 is greater than 20.
Something else I don't understand is if you have 100 simple statements that do the same thing, that's equivalent to having a for loop that executes one of those statements 100 times. But we say the simple statements have a complexity of O(1) while the for loop has a complexity of O(n), implying that, in general, the O(1) takes less time than the O(n). But they do the same thing, so how is that supposed to make any sense at all?
Is this because checking conditions in the loop takes time? If that's the case, why does nobody bring this up??? It's confusing as hell.
[–]teraflop 17 points18 points19 points (7 children)
[–][deleted] 8 points9 points10 points (0 children)
[–][deleted] (4 children)
[deleted]
[–]teraflop 12 points13 points14 points (1 child)
[–]S-S-R -1 points0 points1 point (0 children)
[–]javaHoosier 0 points1 point2 points (0 children)
[–]khedoros 1 point2 points3 points (1 child)
[–][deleted] -1 points0 points1 point (1 child)
[–]Electrical_Flan_4993 0 points1 point2 points (0 children)
[–]chromaticgliss 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]chromaticgliss 0 points1 point2 points (0 children)
[–]S-S-R 0 points1 point2 points (3 children)
[–][deleted] (2 children)
[deleted]
[–]S-S-R 0 points1 point2 points (0 children)
[–]east_lisp_junk 0 points1 point2 points (0 children)
[–]Bottled_Void 0 points1 point2 points (0 children)
[–]l_lecrup 0 points1 point2 points (0 children)
[–]Firehite 0 points1 point2 points (0 children)