C++ 链表
zhangtonghui816
这个作者很懒,什么都没留下…
展开
-
双向链表的源码实现
#include using namespace std;typedef int ElmType;const int length=10;typedef struct node{ ElmType i; struct node* next; struct node* back;}Node;typedef Node* pNode;void ini原创 2012-12-31 16:24:08 · 585 阅读 · 0 评论 -
单链表的C++实现
#include using namespace std;templatestruct node{ T num; node *next;};templateclass list{public: list(); ~list(); void tranverse(); void insert_node(int place,T n);原创 2013-01-12 14:42:42 · 640 阅读 · 0 评论 -
单链表反转
#include using namespace std;struct node{ int num; node* next;};class list{public: list(); void print(); void turnover();private: node* p; node* q; node* head;};原创 2013-01-15 17:23:59 · 641 阅读 · 0 评论 -
栈的顺序存储结构的C++实现
#include using namespace std;#define max 5templateclass stack{public: stack(); bool pop(T &m); //将出栈的元素给m bool push(T n);//将元素n进栈 void print();private: T a[max]; int top;原创 2013-01-13 19:38:19 · 1317 阅读 · 0 评论 -
二叉排序树+中序遍历
#include using namespace std;templatestruct node{ T num; node* Lnext; node* Rnext;};templateclass list{public: list(); void node_delete(T *p); void node_insert(T *p);原创 2013-01-16 18:23:31 · 217 阅读 · 0 评论 -
二叉排序树的C++实现,包括难点删除
#include using namespace std;struct node{ int num; node* Lnext; node* Rnext;};//建立二叉排序树class list{public: list(); void node_insert(); //p为要删除的节点,p0为删除节点的前一个节点,当然两节点可能重合 //fla原创 2013-01-17 21:15:41 · 2347 阅读 · 0 评论 -
排序二叉树实现(比昨天的版本改进了些)
#include using namespace std;struct node{ int num; node* Lnext; node* Rnext;};class list{public: list();//构造函数,为了省略直接完成list的建立 void node_insert(int n);//n代表要插入的数字 void delet原创 2013-01-18 11:12:02 · 92 阅读 · 0 评论 -
非递归前中后序遍历(多种方式)
#include #include using namespace std;struct Node{ Node* lchild; Node* rchild; char value;};class list{public: list::list(); void PreOrder(); void InOrder(); void PostOrd原创 2013-03-11 16:52:01 · 944 阅读 · 0 评论