标签:color getc 复杂度 cube inpu input uber class ret
/** * 求一个数的立方根,利用二分法,时间复杂度在logn **/ private static double getCubeRoot(double input){ double min = 0; double max = input; double mid = 0; while ((max - min) > 0.0001){ mid = (max + min) / 2; if(mid * mid * mid > input){ max = mid; continue; } if(mid * mid * mid < input){ min = mid; continue; } return mid; } return max; }
标签:color getc 复杂度 cube inpu input uber class ret
原文地址:https://www.cnblogs.com/dongma/p/13221738.html