
算法
iteye_3963
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
KMP 字符串匹配
[code="java"]public class KMPProcess { public static void buildNext(String str, int[] next) { if (str == null || next == null || str.length() != next.length) throw new IllegalArgumentEx...原创 2011-02-27 17:47:50 · 134 阅读 · 0 评论 -
快速排序
自己复习下基础,做下记录。。。[code="java"]public class QSort { public static void qsort(int[] values, int start, int end) { if (start < 0 || start >= end || values == null || values.length i && value...原创 2011-02-27 17:51:54 · 102 阅读 · 0 评论 -
归并排序算法
[code="java"]public class MergeSort { public static int[] merge(int[] arr1, int[] arr2) { int[] temp = new int[arr1.length + arr2.length]; int start1 = 0; int start2 = 0; int en...原创 2011-02-27 17:54:34 · 119 阅读 · 0 评论 -
Fibonacci
just 复习些概念,写写点代码。。。[code="java"]public static int f (int n) { if (n == 0) return 0; if (n == 1) return 1; return f(n - 1) + f(n - 2); } public static int f1 (int n) {...原创 2011-02-27 17:56:50 · 114 阅读 · 0 评论 -
堆排序
[code="java"]public class Heapsort { public static int[] Heap = { 10, 32, 1, 9, 5, 7, 12, 0, 4, 3 }; // 预设数据数组 public static void buildMaxHeap(int[] heap, int start, int end) { if (heap =...原创 2011-02-27 18:46:26 · 100 阅读 · 0 评论 -
给一个参数n,求这个数的所有整数求和排列,不允许有重复
给一个参数n,求这个数的所有整数求和排列,不允许有重复简单解答,算法还有优化空间[code="java"]public static void main(String[] args) { int n = 10; int[] pre = new int [(int)Math.sqrt(2 * n)]; p1(n, 1, pre, 0); ...原创 2011-02-28 23:57:21 · 170 阅读 · 0 评论 -
约瑟夫环
输出整个过程[code="java"] public static void process(int n, int m) { if (n原创 2011-03-06 17:49:32 · 117 阅读 · 0 评论