随笔分类 -  c++数据结构

摘要:queue.h #ifndef QUEUE_H_ #define QUEUE_H_ #include<iostream> template<class T> struct Node { T data; Node<T>* next; }; template<class T> class Queue { 阅读全文
posted @ 2020-07-04 12:07 m晴朗 阅读(16) 评论(0) 推荐(0) 编辑
摘要:stack.h #ifndef STACK_H_ #define STACK_H_ #include<iostream> template<class T> struct Node { T data; Node<T>* next; }; template<class T> class Stack { 阅读全文
posted @ 2020-07-04 11:11 m晴朗 阅读(84) 评论(0) 推荐(0) 编辑
摘要:LinkList.h #ifndef LINKLIST_H_ #define LINKLIST_H_ #include<stdio.h> template<class T> struct Node { T data; struct Node<T>* next; }; template<class T 阅读全文
posted @ 2020-07-03 09:31 m晴朗 阅读(91) 评论(0) 推荐(0) 编辑
摘要:与单循环链表类似,但析构函数需要注意 析构函数: 因为while循环的条件是p->next!=front,所以不能直接delete front; template<class T> TWLinkList<T>::~TWLinkList() { Node<T>* p = front; while (p 阅读全文
posted @ 2020-05-21 11:49 m晴朗 阅读(15) 评论(0) 推荐(0) 编辑
摘要:目录 单循环链表说明注意 (一)无参构造函数(二)有参构造函数(三)析构函数(四)获取长度(五)打印数组(六)获取第i个元素的地址(七)插入(八)删除(九)获取值为x的元素的位置(十)排序(十一)连接(十二)整个文件CircleList.hUseCircleList.cpp 单循环链表 说明 单循环 阅读全文
posted @ 2020-05-19 19:05 m晴朗 阅读(212) 评论(0) 推荐(0) 编辑
摘要:SeqList.h #ifndef SEQLIST_H_ #define SEQLIST_H_ #include<iostream> const int Max=100; template<class T> class SeqList{ private: T data[Max]; int Lengt 阅读全文
posted @ 2020-05-17 10:01 m晴朗 阅读(22) 评论(0) 推荐(0) 编辑
摘要:线性表的运算 求长度GetLength(L),求线性表L的长度置空表SetNull(L),将线性表置成空表按位查找Get(L,i),查找线性表L第i个元素按值查找Location(L,x),查找线性表L值为x的元素修改Set(L,i,x),将线性表L第i位置的元素,修改为x插入Insert(L,i, 阅读全文
posted @ 2020-04-19 17:42 m晴朗 阅读(27) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示