3 ms·
> These are mostly O(1) things and shouldn't matter. I often hear this from programmers coming from a higher-level background. O(1) only means constant time. I
by weland 13y ago
> These are mostly O(1) things and shouldn't matter.
I often hear this from programmers coming from a higher-level background. O(1) only means constant time. It doesn't mean quickly. This function:
int foo(int x) {
sleep(3600);
return x;
}
is O(1), just as this:
int bar(int x) {
return x;
}
Foo takes an hour to commplete, but it's just as O(1) as bar :-).