
数据结构
ptuaena
分享学习c++的感悟,和写的数据结构代码
展开
-
c++实现链栈
#include <iostream>using namespace std;typedef struct linked{ int val; struct linked *pNext;}*PNODE;class stack_linked{public: void Init_stack(class stack_linked *); bool push(class stack_linked *, PNODE, int); void show_s.原创 2022-03-13 13:30:23 · 1203 阅读 · 0 评论 -
c++实现顺序栈
#include <iostream>#include <cstdlib>#include <string>#define StackInitSize 5#define StackIncreace 2using namespace std;bool em(struct Stack *);struct Stack{ int Stack_size; //目前栈的容量 int Stack_num; //定义两个指针,top指向栈顶,ba.原创 2022-03-13 13:29:26 · 1784 阅读 · 0 评论 -
数组的增删改显,冒泡排序 c++实现
#include <iostream>#include <cstdlib>using namespace std;class Arr{public: void init_arr(struct Arr *arr, int length){ arr->p = new int [length]; if (NULL == arr->p){ cout << "memory allocation.原创 2022-03-11 11:03:58 · 562 阅读 · 0 评论 -
c++实现单链表
#include <iostream>#include <cstdlib>using namespace std;typedef struct Node{ int data; struct Node * pNext;}*PNODE;PNODE creat_list(){ int len, val; PNODE pHead = new Node; PNODE pTemp = pHead;//创建新指针令它永远指向尾节点 .原创 2022-03-11 13:53:53 · 501 阅读 · 0 评论