摘要: 数组栈ArrayStack类源码:#pragma once//数组栈template class ArrayStack{public: //初始化栈 ArrayStack(void) { StackSize = 20; top = -1; elem = new T [StackSize]; } //入栈 void push(T obj) { if(!IsFull()) { top++; elem[top]=obj; } ... 阅读全文
posted @ 2013-09-25 15:05 夏阳秋时 阅读(361) 评论(0) 推荐(0) 编辑
摘要: MyLinkList实现代码package MyLinkedList;import java.lang.reflect.ParameterizedType;public class MyLink { private Entity header; private int size; public MyLink() { this.header = new Entity(null,null,null); this.size = 0; this.header.next = (this.header.previous=this.h... 阅读全文
posted @ 2013-09-24 15:51 夏阳秋时 阅读(265) 评论(0) 推荐(0) 编辑
摘要: MyArrayList类实现代码 1 #pragma once 2 3 template 4 class MyArrayList 5 { 6 public: 7 8 int Length; //list中已有的元素的个数 9 10 MyArrayList(void) 11 { 12 Length = 0; 13 size = 10; 14 index = 0; 15 list = new T [10]; 16 } 17 18 MyArrayList(int Siz... 阅读全文
posted @ 2013-09-24 15:46 夏阳秋时 阅读(583) 评论(0) 推荐(0) 编辑
摘要: (一)选择排序法原理:将序列划分为无序和有序区,寻找无序区中的最小值和无序区的首元素交换,有序区扩大一个,循环最终完成全部排序 1 void SortList::SelectSort(int *list,int length) 2 { 3 int i,j,min; //i为有序区,j为无序区,min为无序区最小元素下标 4 for(i=0;ilist[j+1]) 9 {10 int t = list[j+1];11 list[j+1]=list[j];12 l... 阅读全文
posted @ 2013-09-24 15:39 夏阳秋时 阅读(206) 评论(0) 推荐(0) 编辑