问题
I have written java code for finding taxicab numbers using math.cbrt(a)
function. I assumed the complexity of math.cbrt(a)
is constant. I am really interested in knowing the complexity of this function such that I can know how good my algorithm works.
Visit Finding taxicab Numbers
回答1:
This method is native, so exact call depends on VM implementation. Eg. OpenJDK use fdlibm as you can check here http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/9b8c96f96a0f/src/share/native/java/lang/StrictMath.c
and fdlibm implementation is here http://www.netlib.org/fdlibm/s_cbrt.c which seems to be constant.
来源:https://stackoverflow.com/questions/28538292/time-complexity-of-the-math-cbrta-method-in-java-math-library