随笔分类 -  数据结构

摘要:栈中的入栈、出栈以及获取栈顶元素方法的实现: 阅读全文
posted @ 2017-06-24 19:54 稻草人部落 阅读(330) 评论(0) 推荐(0)
摘要:定义一个列表(List)模板类,实现列表的初始化、插入、删除操作: 阅读全文
posted @ 2017-06-24 17:49 稻草人部落 阅读(660) 评论(0) 推荐(0)
摘要:定义一个向量(vector)模板类,实现向量的初始化、插入、删除操作: 阅读全文
posted @ 2017-06-24 13:32 稻草人部落 阅读(533) 评论(0) 推荐(0)
摘要:1 #include "stdafx.h" 2 #include 3 using namespace std; 4 template 5 #define DEFAULT_CAPACITY 3 6 class vector 7 { 8 private: 9 int size; 10 int capacity; 11 T* elem... 阅读全文
posted @ 2017-06-03 20:45 稻草人部落 阅读(253) 评论(0) 推荐(0)
摘要:1 #include "stdafx.h" 2 typedef int Rank; //秩 3 #define DEFAULT_CAPACITY 3 //默认的初始容量(实际应用中可设置为更大) 4 5 template class Vector 6 { //向量模板类 7 protected: 8 Rank _size; int _c... 阅读全文
posted @ 2017-05-24 21:09 稻草人部落 阅读(1126) 评论(0) 推荐(0)