
C/C++数据结构
banjitino
爱技术,爱生活。
展开
-
C++ 模板类实现栈的顺序存储和链式存储
SqStack.h #pragma once #include <iostream> using namespace std; template <typename T> class SqStack { public: SqStack(int m = 0); ~SqStack(); void Clear(); bool Empty(); int Length()...原创 2020-03-25 18:24:05 · 462 阅读 · 0 评论 -
C++根据前中序重建二叉树,并输出后序遍历
给定一个二叉树的前序遍历和中序遍历的序列,输出对应这个二叉树的后续遍历序列。 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <string> using namespace std; //Definition for binary tree temp...原创 2020-03-14 18:18:35 · 881 阅读 · 0 评论 -
C/C++ 链表就地逆置
本文采用改变next指针指向的方法就地逆置; 也可采用头插法就地逆置。 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> using namespace std; typedef struct ListNode { int val; struct ListNode* ...原创 2020-03-14 18:16:27 · 545 阅读 · 0 评论