Given a binary tree, return theinordertraversal of its nodes' values.和preorder是一样的,把左子节点一直压入到栈中,直到没有左子节点为止,然后出栈访问,存储右子节点。 1 vector inorderTraversal(Tr...
分类:
其他好文 时间:
2015-03-15 00:42:02
阅读次数:
111
Given a binary tree, return thepreordertraversal of its nodes' values.简单题,递归和迭代都可以解。 1 class Solution { 2 public: 3 vector preorderTraversal(TreeN...
分类:
其他好文 时间:
2015-03-15 00:41:43
阅读次数:
104
Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation...
分类:
其他好文 时间:
2015-03-15 00:36:38
阅读次数:
159
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return...
分类:
其他好文 时间:
2015-03-14 22:59:56
阅读次数:
243
声明:尊重原创,转载请注明出处http://blog.csdn.net/lizo_is_me/article/details/442600251 平衡二叉树平衡二叉树(Balanced binary tree)是由阿德尔森-维尔斯和兰迪斯(Adelson-Velskii and Landis)于1962年首先提出的,所以又称为AVL树。定义:平衡二叉树或为空树,或为如下性质的二叉排序树:(1)左右子...
分类:
其他好文 时间:
2015-03-14 21:49:37
阅读次数:
616
本文主要介绍Sublime Text如何开启debug模式,以及分析一些使用过程中常见错误的解决方法。情形一Package Control:There are no packages available for installation。情形二:Package Control:Unableto download Emmet.Please view the console for more details. Error while loading PyV8 binary:exit code 3 …情形三:无法...
分类:
其他好文 时间:
2015-03-14 18:34:13
阅读次数:
2177
Binary Tree Zigzag Level Order Traversal问题:Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, t...
分类:
其他好文 时间:
2015-03-14 18:32:16
阅读次数:
128
题目:
Given two binary strings, return their sum (also a binary string).For example,
a = “11”
b = “1”
Return “100”. 分析:
思路一:刚开始我想的是将a和b转成数字,然后相加,结果在转成二进制字符。这种方法在a和b长度比较小的时候可行,a和b太长的时候,转成数字int或者long...
分类:
其他好文 时间:
2015-03-14 16:56:40
阅读次数:
126
Reverse Bits问题:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as000000101001010000011110100...
分类:
其他好文 时间:
2015-03-14 16:42:44
阅读次数:
114
二叉树的中序遍历,没啥好说的/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) :...
分类:
其他好文 时间:
2015-03-14 16:41:54
阅读次数:
126