- 博客(9)
- 资源 (18)
- 收藏
- 关注
原创 求最大子序列的乘积
最大子序列的乘积,两种方法:1.方法一的时间复杂度为O(n^2),这个方法是通过循环遍历所有的子序列。public static int maxSubMulti(int[] a){ int maxsub = 0; int minsub = 0; for(int i = 0 ; i < a.length ; i++){ int te
2017-09-18 23:21:54 757
原创 生成前N个整数的一个随机置换java实现
这个问题数据结构与算法分析java语言描述版,第二章的2.8课后习题的。下面我的三种不同的实现:随机数生成函数 public static int randInt(int i, int j) { int temp = (int) (Math.random() * j + i); return temp; }1.时间复杂度为O(n^2) public
2017-09-15 16:48:44 679
原创 求最小正序列的和java实现
1.时间复杂度是O(n^2)public static int minPosSubSum(int[] a) { int thissum = 0; int minsum = 0; for(int i = 0 ; i < a.length ; i++){ if(a[i] > 0){ minsum =
2017-09-15 16:36:23 364 1
原创 求两个数的公因数的两种方法java实现
1.方法一是,循环取余计算 public static int gcd(int a,int b){ while(b != 0){ int temp = a % b; a = b; b = temp; } return a; }2.方法二,递归实现。 public s
2017-09-15 16:05:32 4972 1
原创 最大子序列和的四种不同复杂度实现
1.最差的时间复杂度实现O(n^3)public static int worst(int [] a){ int maxSum = 0; for(int i = 0 ; i < a.length ; i++){ for(int j = i ; j < a.length ; j++){ int thissum = 0;
2017-09-15 15:59:43 359
原创 TwoSum--python
1.TowSum 问题描述: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you
2017-09-05 12:53:21 270
原创 Non-decreasing Array
问题描述:Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.We define an array is non-decreasing if array[i] <= array[i + 1] holds for ev
2017-09-03 12:21:11 298
原创 距离和相似度计算总结
闵可夫斯基距离Minkowsli: P=(x1,x2,...,xn)andQ=(y1,y2,...,yn)∈RnP = (x_1,x_2,...,x_n) \,\, and\,\,Q=(y_1,y_2,...,y_n) \in \Bbb R^n 是衡量数值点之间距离的一种非常常见的方法,假设数值点PP和QQ坐标如上:那么,闵可夫斯基距离定义为: dist(X,Y)=(∑
2017-09-03 00:29:08 1594
Data Structure Visualizations.zip
2019-12-03
Android OpenGL ES 2.0 2D/3D 游戏开发电子书下载
2016-05-13
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人