算法(java描述)
suncheng_hong
OO理想主义者
展开
-
冒泡排序(java版)
冒泡排序:class ArrayBub { private long[] a; private int nElems; public ArrayBub(int num){ a = new long[num]; nElems = 0; } public void insert(long item){ a[nElems] = item; nElems ++; } public long原创 2006-04-20 15:14:00 · 1612 阅读 · 1 评论 -
栈
class Stack { private long[] s; private int top; private int length; public Stack(int length){ this.length = length; s = new long[length]; top = -1; } public void push(long item){ s[++top] = item;原创 2006-04-21 14:24:00 · 860 阅读 · 0 评论 -
选择排序
class Array { private long[] a; private int nElems; public Array(int num){ a = new long[num]; nElems = 0; } public void insert(long item){ a[nElems] = item; nElems ++; } public long getElem(int i原创 2006-04-20 23:12:00 · 801 阅读 · 0 评论