Time complexity of the Math.cbrt(a) method in java.math library

不羁的心 提交于 2020-01-25 16:23:31

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!