Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is the underlying algo not O(1)? Under what pairs of two u10000 numbers would you get different execution time?


Sure, if you ignore the n in n=10000, multiplication is O(1). But the same is true for e.g. heapsort--all lists of 10000 items take asymptotically the same amount of time to sort.

But that's a strained interpretation of complexity, and not very useful.


A heapsort is designed to take a variable number of items at runtime for given code. The n is fixed at compile time in the multiplication examples and is invariant at comptime (in zig).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: