r/shittyprogramming • u/shatteredarm1 • Jun 11 '21
Constant time isEven in C#
public boolean isEven(int number) {
throw new NotImplementedException();
}
107
Upvotes
r/shittyprogramming • u/shatteredarm1 • Jun 11 '21
public boolean isEven(int number) {
throw new NotImplementedException();
}
34
u/shatteredarm1 Jun 11 '21
Actually, this would be needed in order for this to compile:
9
u/suresh Jun 11 '21
I know what sub we are in, but you do realize isEven() will basically always be in O(1) though right? There is no iteration.
3
u/pkarlmann Jun 12 '21
This is basically the whole Windoze source code.
1
u/[deleted] Jun 12 '21
Unwinding the call stack isn't even constant time. Well done!