且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java 7的BigInteger操作有多复杂?

更新时间:2023-09-13 10:36:46

如果你看一下 BigInteger (随JDK提供),在我看来
multiply(..) O(n ^ 2)(实际上该方法是 multiplyToLen(..))。其他方法的代码有点复杂,但你可以看到自己。

If you look at the code for BigInteger (provided with JDK), it appears to me that multiply(..) has O(n^2) (actually the method is multiplyToLen(..)). The code for the other methods is a bit more complex, but you can see yourself.

注意:这是针对Java 6.我假设它在Java中没有区别7。

Note: this is for Java 6. I assume it won't differ in Java 7.