Tag Info

New answers tagged

0

While instanceof should be avoided some Java interfaces require it as part of their contract. For example: javax.security.auth.callback.CallbackHandler. It defines: void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException Callback is an interface with no methods so the only way to differentiate different types of Callback ...


5

This is really hard to answer, because a ton of information is missing: How did you measure those sizes? Do they include libraries required to run the interpreter? Do they include runtimes? What Python implementation are you talking about? There are four production-ready implementations of Python in current use (PyPy, IronPython, Jython, CPython), plus ...


3

If looks like a O(n³) solution. Your instinct is correct: by resetting variables you are looping. Note: if we only consider the loop instruction we would, mistakenly, think it was O(∞). However the problem is O(n). Therefore you can do better.


1

Rating the relative strengths of teams/contestants is sort of a solved problem, so why re-invent the wheel? There is the Elo rating system, originally devised for chess, and there is also the Glicko (pdf) rating system. Both systems try to model the probability that one contestant will win against another, and produce a score representing their relative ...



Top 50 recent answers are included