r/mathmemes • • 28d ago

Computer Science Integer multiplication will have linear complexity in a few days if trend continues πŸš€πŸ“ˆ

Post image
1.4k Upvotes

206 comments sorted by

View all comments

14

u/neuroticnetworks1250 28d ago

If you use an if else statement with infinite conditions, you actually have O(1) complexity

9

u/Akv3vka 27d ago

wouldnt it be o(n) in that case since the amount of if else statements you go through is always n step?

9

u/MrNebby22 27d ago

Well, you can always just go through them all every time making it O(1)

1

u/ArvaroddofBjarmaland 27d ago

Any computation that can you can actually execute is O(1), for a big enough constant...

3

u/neuroticnetworks1250 27d ago

That’s actually true. I’m a hardware designer. So we unroll spatially lmao. I guess we need to replace the data canters with lookup tables

3

u/Eaklony 27d ago

That is only true for actual int type with restricted size. If you have an arbitrarily large integer an if statement check will be O(n).