- 博客(10)
- 收藏
- 关注
原创 两个向量(数组)点对点相加(Java)
两个向量(数组)点对点相加(Java)public class CMatrix { private CMatrix() {} /** * addition of two vectors. * * @param x one vector * @param y another vector * @return result vecto...
2018-04-09 00:47:29 3479
原创 根据整型数组统计该数组所有整型元素出现的频率(当数组长度足够时即可近似得到概率)
根据整型数组统计该数组所有整型元素出现的频率(当数组长度足够时即可近似得到概率)import java.util.HashMap;import java.util.Map;import java.util.Set;public class CProbability { private CProbability() {} public static Map<Integ...
2018-04-09 00:40:56 344
原创 翻转(逆序重排列)数组元素(Java)
翻转(逆序重排列)数组元素(Java)public class CArrays { private CArrays() {} /** * Reverse the object array. * * @param arr object array * @param <T> object type * @return th...
2018-04-09 00:37:01 866
原创 求一个整数的二进制表示法(Java)
求一个整数的二进制表示法(Java)public class CInteger { private CInteger() {} /** * Convert decimal integer to binary string * * @param n decimal integer * @return binary string */...
2018-04-09 00:34:08 4068
原创 数组二分查找法(Java)
数组二分查找法(Java)public class CSearch { /** * Use binary search method to find specific element from an array. * * @param key specific element * @param arr array * @return if...
2018-04-09 00:32:22 491
原创 根据数组数据源统计出量化级数为m的直方图数组
根据数组数据源统计出量化级数为m的直方图数组public class CMath { private CMath() {} /** * Statistical histogram. * * @param arr value array * @param m quantization level * @return histogra...
2018-04-09 00:30:19 311
原创 求二项分布的n次试验k次成功的具体概率
求二项分布的n次试验k次成功的具体概率public class CMath { private CMath() {} /** * Compute binomial distribution probability. * * @param n Total number of experiments * @param k Total numbe...
2018-04-09 00:28:42 4127
原创 求一个浮点数的平方根——牛顿迭代法
求一个浮点数的平方根——牛顿迭代法public class CMath { private CMath() {} /** * Calculate the square root of a double floating-point number. * * @param d the double floating-point number *...
2018-04-09 00:25:17 2627
原创 求一个整数是否为素数(质数)
求一个整数是否为素数(质数)public class CMath { private CMath() {} /** * Determine whether an integer is a prime. * * @param n the integer * @return result */ public static bo...
2018-04-09 00:22:38 462
原创 求两个非负整数的最大公约数——欧几里得算法
求两个非负整数的最大公约数——欧几里得算法public class CMath { private CMath() { } /** * Calculate the maximum common divisor of two nonnegative integers. * * @param p A nonnegative integer ...
2018-04-09 00:18:29 1255
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人