03 2014 档案

摘要:package Alg;import java.util.Random;public class QuickSort { public static void quickSort(int[] ary) { quickSort(ary, 0, ary.length - 1); } /** * @param ary 数组 排序数组 * @param start 开始位置 ,0-base index * @param end 结束位置,0-base index */ private static void quickSort(int[] ary, int start, int end) ... 阅读全文
posted @ 2014-03-19 22:52 惡盈好謙 阅读(121) 评论(0) 推荐(0) 编辑
摘要:经过几个星期的努力,红黑树终于弄清楚了。先附上代码,然后贴上自己的分析图package Alg;public class RBTreeNode { public enum Color {Red , Black }; private RBTreeNode leftChild = null; private RBTreeNode rightChild = null; private RBTreeNode parent = null; private int value = Integer.MIN_VALUE; private Color color = Color.Red; private ... 阅读全文
posted @ 2014-03-16 23:02 惡盈好謙 阅读(290) 评论(0) 推荐(0) 编辑
摘要:package Alg;public class BSTree { private BSTreeNode root = null; //树根节点 private int count = 0; //树的节点数 public int getCount() { return count; } public enum MatchType {E, GE, LE}; /** * 根据值进行搜索 * @param val 匹配值 * @param matchType 匹配方式 E为严格相等匹配,GE为大于等于匹配,LE为小于等于匹配 * @return 匹配模式为E时,如果没有找到匹配项,... 阅读全文
posted @ 2014-03-02 10:55 惡盈好謙 阅读(415) 评论(0) 推荐(0) 编辑