自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(12)
  • 收藏
  • 关注

原创 Tstress

用几天时间写了个压测工具,代码链接:Githubhttps://github.com/tangyuanzong/Tstress/tree/master参数说明: -T 总线程数 -S HTTP总连接数 -C 并发连接数 H / S 每秒建立的HTTP数目...

2019-01-25 21:15:36 529

原创 297. Serialize and Deserialize Binary Tree (Tree)

链接:https://leetcode.com/problems/serialize-and-deserialize-binary-tree/题目:自定义二叉树序列化与反序列化协议。思路:自定义序列化格式:{root->val:root->left->val,root->right->val}例如 1 / \ 2 3 / \...

2019-01-16 11:35:01 350

原创 145. Binary Tree Postorder Traversal(Tree)

链接:https://leetcode.com/problems/binary-tree-postorder-traversal/题目:二叉树后序遍历思路:题目很简单,但是却是Hard难度。。。。。。。。代码:class Solution {public: void post(TreeNode* root){ if(!root) return; ...

2019-01-14 11:46:32 253

原创 429. N-ary Tree Level Order Traversal(Tree)

链接:https://leetcode.com/problems/n-ary-tree-level-order-traversal/题目:N叉树的层次遍历思路:与二叉树层次遍历相似代码:class Solution {public: vector<vector<int>> levelOrder(Node* root) { ...

2019-01-14 11:38:01 166

原创 102. Binary Tree Level Order Traversal(Tree)

链接:https://leetcode.com/problems/binary-tree-level-order-traversal/题目:二叉树层次遍历思路:BFS代码:class Solution {public: vector<vector<int>> levelOrder(TreeNode* root) { v...

2019-01-14 11:34:37 153

原创 653. Two Sum IV - Input is a BST(Tree)

链接:https://leetcode.com/problems/two-sum-iv-input-is-a-bst/题目: 判断BST中是否有两个原始的和等于k思路: BST中序遍历的结果为有序数组;然后再扫描数组判断即可(复杂度O(n))代码:class Solution {public: void inorder(TreeNode* root){ if(...

2019-01-13 22:40:50 159

原创 590. N-ary Tree Postorder Traversal(Tree)

链接:https://leetcode.com/problems/n-ary-tree-postorder-traversal/题目:求n叉树的后续遍历思路:与二叉树的后续遍历类似。代码:class Solution {public: void post(Node* root){ if(!root) return; f...

2019-01-13 20:35:42 232

原创 513. Find Bottom Left Tree Value(Tree)

链接:https://leetcode.com/problems/find-bottom-left-tree-value/题目:求二叉树最底层的最左边元素思路: 层次遍历代码:class Solution {public: int findBottomLeftValue(TreeNode* root) { int val = root->val;...

2019-01-13 20:21:18 177

原创 105. Construct Binary Tree from Preorder and Inorder Traversal(Tree)

链接:https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/题目:已知前序和中序遍历,构造原二叉树。思路:与前一题类似:https://blog.csdn.net/tangyuanzong/article/details/86261711根节点在前序遍历的第一个位置,在中...

2019-01-11 13:54:50 147

原创 106. Construct Binary Tree from Inorder and Postorder Traversal(Tree)

链接:https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/题目:给定二叉树中序和后序遍历,构造出原二叉树。思路:根节点在后序遍历的最后一个位置,在中序遍历的中间位置。通过后序遍历找到根节点,然后通过中序遍历找出左右子树,然后递归构造。例如给定样例:inorder =...

2019-01-10 22:54:06 204

原创 108. Convert Sorted Array to Binary Search Tree(Tree)

链接:https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/题目:将有序数组转换成BST思路:对于当前区间,新建节点,节点值为数组当前区间中间的元素,然后后续遍历,递归构建代码:class Solution {public: TreeNode* order(vector<int&gt...

2019-01-01 10:40:24 145

原创 230. Kth Smallest Element in a BST(Tree)

链接:https://leetcode.com/problems/kth-smallest-element-in-a-bst/题目:求BST第k小元素思路:中序遍历,然后计数。代码:class Solution {public: void order(TreeNode *root,int k){ if(!root || num > k) return; ...

2019-01-01 10:18:19 176

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除