![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
笔记
假装得大佬
这个作者很懒,什么都没留下…
展开
-
2020-11-07
最大连续子序列和问题 蛮力法求解: 时间复杂度为:o(n^3) 空间复杂度为:o(n) 蛮力法实现如下: package algorithm; public class Solution { public static void main(String[] args) { // TODO Auto-generated method stub int[] nums = new int[] {-2,1,-3,4,-1,2,1,-5,4}; int max; max=solve(nums);原创 2020-11-07 18:56:33 · 95 阅读 · 0 评论 -
2020-11-07
求解0/1背包问题 动态规划代码实现如下: package algorithm; public class Solution { public static void main(String[] args) { // TODO Auto-generated method stub int[] v = new int[] { 0, 4, 5, 10, 11, 13 }; int[] w = new int[] { 0, 3, 4, 7, 8, 9 }; int W = 17; i原创 2020-11-07 17:43:23 · 252 阅读 · 0 评论 -
2020-10-30
Comparable和Comparator的区别 区别1:一般用作比较器的的接口是comparable,用得最多的也是Comoarable。而Comparator是一个补救措施,一般用作满足程序开发后期的使用。 区别2:用法的区别 Comparable:将所要实现排序的类,实现Comparable接口,在类中实现CompareTo方法。便可直接使用Collections.sort()进行排序。 Comparator: ...原创 2020-10-30 10:13:31 · 107 阅读 · 0 评论