
数据结构与算法
iteye_5603
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
二叉树
大家都知道,要对一个对象进行排序可以利用java提供的Comparable<T>接口和Arrays工具类实现。 在实现Comparable<T>接口时要实现下面的方法 public int compareTo(T t); 此方法返回1,0和-1。返回1表示升序,-1表示降序。0表示相等。 为什么要这样定义?出于好奇,我查看了源代码,发现此方法是利用了数据结构里面的...2010-04-13 13:09:29 · 114 阅读 · 0 评论 -
java实现的简单链表
** * 实现的简单链表 * @author zcl * */ public class LinkedList { public class Node { private String nodeName; private Node next; public Node(String name) { nodeName = name; ...2010-04-15 13:10:38 · 146 阅读 · 0 评论 -
java实现的折半查找
/** * 折半查找 * author: zcl */ public class BinarySearch { public static int search(int[] arrays, int target) { int start = 0; int end = arrays.length - 1; int pos; while (star...2010-04-15 13:12:56 · 181 阅读 · 0 评论