10.15总结
来源:互联网 发布:p2p网络管理器 编辑:程序博客网 时间:2024/06/05 11:20
package Text;
public class Stack {
private Object[] objects;
private int head;
private int size;
public Stack(int size) { objects = new Object[size]; this.head = 0; this.size = 0;}public void push(Object object) throws Exception { if (this.size == objects.length) throw new Exception("this stack is full"); objects[head++] = object; size++;}public Object pop() throws Exception { if (size == 0) throw new Exception("this stack is empty"); size--; return objects[--head];}
}
package Text;
public class Queue {
private Object[] objects;
private int size;
private int head;
private int end;
public Queue(int size) { this.objects = new Object[size]; this.head = 0; this.end = 0; this.size = 0;}public void push(Object object) throws Exception { if (this.size > objects.length) throw new Exception("Queue is full!"); objects[end++] = object; size++;}public Object pop() throws Exception { if (this.size == 0)
// return null;
throw new Exception(“Queue is empty!”);
if (head == objects.length)
this.head = 0;
size–;
return objects[head++];
}
public Object peek() throws Exception { if (this.size == 0) throw new Exception("Queue is empty!"); return objects[head];}public boolean isEmpty() { return size == 0;}public boolean isFull() { return size == objects.length;}public int getSize() { return size;}
}
冒泡排序
package sort;
public class Bubble1 {
public static int[] sort(int[] a){
for(int i=0;i
阅读全文
0 0
- 10.15总结
- 10.15考试总结
- 10.14、10.15学习总结
- 10.15_总结
- 训练总结 10.15
- 10.15上课总结
- 10.15考试总结
- 总结
- 总结
- 总结
- 总结
- 总结!
- 总结
- 总结.
- 总结。
- 总结
- 总结
- 总结
- 概率基础及贝叶斯决策理论
- 计算几何(具象的难题)
- <Myeclipse> Servlet之连接数据库查询
- 操作系统之内存管理(一)(未引入虚拟内存之前部分)
- Rust : 求出一个字符串数组中最长的公共连续子序列
- 10.15总结
- 2016级算法第一次上机——E ModricWang's QuickSort
- 猜数字游戏
- centos7 配置多个Tomcat
- Drawerlayout
- 实现侧栏,为Xlistview获取网络数据
- jquery表单验证
- XListView
- SSD及其不同主网络实现的性能差异比较