
C++数据结构
崖高人远
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
链表类
#include #include using namespace std;typedef int T; class List{private: struct Node { T data; Node* next; Node(const T& d):data(d),next() { } }; Node* head; int sz; //返回指针引用转载 2012-10-08 23:57:43 · 452 阅读 · 0 评论 -
用数组实现vector
#include using namespace std;//用数组实现Vectortypedef int T;class Vector{private: T* data; int sz; int capacity; void expend() { T* tmp = new T[capacity*2]; for (int i = 0; i < sz; i++)转载 2012-10-08 22:40:16 · 793 阅读 · 0 评论 -
直接以操作链表的方式操作节点
#include using namespace std;typedef int T;//节点类//struct 也称类?struct Node{ T data; Node* next; Node(const T& d):data(d),next() { }};void print(Node* p){ while(p != NULL) { cout d转载 2012-10-08 22:42:33 · 607 阅读 · 2 评论 -
链表类,亲自测试使用成员方法
#include #include using namespace std;typedef int T;class List{private: struct Node { T data; Node* next; Node(const T& d):data(d),next() { } }; Node* head; int sz; Node*& getp转载 2012-10-10 01:19:26 · 506 阅读 · 0 评论 -
中缀表达式转后缀表达式
#include #include using namespace std;const int LEN = 50;typedef char T;class Stack{private: T data[LEN]; int sz;public: Stack():sz() { } void push(const T& d) throw(const char*)转载 2012-10-14 18:35:56 · 596 阅读 · 1 评论 -
继承List类实现栈
#include #include "List.h"using namespace std;typedef int T;class Stack : public List //应该私有继承{public: void push(const T& d) { push_front(d); } void pop() { pop_front(); } T top()转载 2012-10-14 17:49:07 · 643 阅读 · 0 评论