JZ26 二叉搜索树与双向链表 Solution 中序遍历 12345678910111213141516171819202122232425262728293031/*struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right( 2021-10-08 algo 二叉树 nowcoder
JZ25 复杂链表的复制 Solution 利用map保存节点信息 123456789101112131415161718192021222324252627/*struct RandomListNode { int label; struct RandomListNode *next, *random; RandomListNode(int x) : labe 2021-10-08 algo 链表 nowcoder
JZ24 二叉树中和为某一值的路径 Solution 回溯法 1234567891011121314151617181920212223242526272829303132333435363738394041/*struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), 2021-10-08 algo 二叉树 nowcoder
JZ23 二叉搜索树的后序遍历序列 Solution 1234567891011121314151617181920class Solution {public: bool VerifySquenceOfBST(vector<int> sequence) { if (sequence.size() == 0) return false; return veri 2021-10-08 algo 二叉树 nowcoder
JZ22 从上往下打印二叉树 Solution 层序遍历 1234567891011121314151617181920212223242526272829303132333435363738/*struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left 2021-10-08 algo 二叉树 nowcoder
JZ21 栈的压入弹出序列 Solution 模拟法 1234567891011121314151617181920class Solution {public: bool IsPopOrder(vector<int> pushV,vector<int> popV) { if (pushV.size() != popV.size()) return 2021-10-08 algo nowcoder 栈
JZ20 包含min函数的栈 Solution 另外用一个栈保存最小值,或者每次压栈/退栈两次 1234567891011121314151617181920212223class Solution {public: stack<int> normal, minVal; void push(int value) { normal.push(value); 2021-10-06 algo nowcoder 数组
JZ19 顺时针打印矩阵 Solution 123456789101112131415161718192021222324252627282930313233343536373839class Solution {public: vector<int> printMatrix(vector<vector<int> > matrix) { v 2021-10-06 algo nowcoder 数组
JZ18 二叉树的镜像 Solution 迭代法,中序遍历 123456789101112131415161718192021222324252627282930313233343536/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : va 2021-10-06 algo 二叉树 nowcoder
JZ17 树的子结构 Solution 递归遍历每个节点 123456789101112131415161718192021222324/*struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) 2021-10-06 algo 二叉树 nowcoder