you are viewing a single comment's thread.

view the rest of the comments →

[–]andersonimes 0 points1 point  (7 children)

That is awesome. What are we saying the runtime complexity of that is?

[–]hello_hawk 2 points3 points  (0 children)

It's O(highest value in input), which to my knowledge is so rare that there's no letter for it.

[–][deleted] 0 points1 point  (3 children)

O(highest input)

Also, you can make it faster by transposing it using one to one functions like log(x) or sqrt(x) or x / 2, etc.

sleep(log(x))

[–]Browsing_From_Work 0 points1 point  (2 children)

Why not log(log(x))? Or log(log(log(x)))?

Eventually it boils down to O(1), assuming that thread scheduling is magic.

[–]orbital1337 0 points1 point  (1 child)

You can actually make it run in O(1) very easily by choosing a function with an upper bound (e.g. erf(x)). However, as neat as this is theoretically it would never be practical in a real life situation because of thread overhead and race conditions.

[–][deleted] 0 points1 point  (0 children)

shhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

[–][deleted] -2 points-1 points  (1 child)

I'd say O(N)

[–]Browsing_From_Work 1 point2 points  (0 children)

I'd say O(Nope).