leetcode-牛客网
王八氮
在对自己失望的这件事上,
我从来没对自己失望过。
那么我一定有一件让自己失望的事没有让自己失望。
展开
-
树的最小深度--牛客网
Description: Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. 提供一个二叉树,查找它的最小深度,这个最小深度大小是沿翻译 2017-03-28 23:01:07 · 368 阅读 · 0 评论 -
栈,逆波兰表达式
Evaluate the value of an arithmetic expression in Reverse Polish Notation. 求一个用逆波兰表示的算数表达式的值。 Valid operators are+,-,*,/. Each operand may be an integer or another expression. 有效的操作是+,-,*,/。每一个操作数可以翻译 2017-03-29 16:14:05 · 199 阅读 · 0 评论 -
二叉树后序遍历
Given a binary tree, return the postorder traversal of its nodes’ values. 给定一个二叉树,返回后序遍历的节点值。For example: Given binary tree{1,#,2,3},//递归实现class Solution {public: void recursive (TreeNode* root翻译 2017-03-29 17:09:44 · 261 阅读 · 0 评论 -
二叉树先根遍历
Given a binary tree,return the preorder traversal of its nodes’ values.For example: given a binary tree (1,#,2,3);class Solution {public: vector<int> recursive(TreeNode* root, vector<int>& ivec){翻译 2017-04-09 10:16:59 · 462 阅读 · 0 评论 -
对链表数据归并排序
Sort a linked list in O(n log n) time using constant space complexity.//采用归并排序class Solution {public: ListNode* findMinddle(ListNode* head){ ListNode* slowPointer = head; Li翻译 2017-04-09 10:20:15 · 282 阅读 · 0 评论 -
对链表数据进行插入排序
Sort a linked list using insertion sort.class Solution {public: ListNode *insertionSortList(ListNode *head) { if(!head || !head->next)return head; ListNode dummyHead(0),*p;翻译 2017-04-09 10:22:22 · 406 阅读 · 0 评论