Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1.....
分类:
其他好文 时间:
2015-05-06 21:02:41
阅读次数:
134
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
For example:
Given binary ...
分类:
其他好文 时间:
2015-05-06 17:50:43
阅读次数:
111
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth...
分类:
其他好文 时间:
2015-05-06 15:01:56
阅读次数:
84
Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only n...
分类:
其他好文 时间:
2015-05-06 14:40:34
阅读次数:
97
题目描述:
Binary Tree Level Order Traversal
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
For example:
Given binary tree {3,...
分类:
其他好文 时间:
2015-05-06 13:23:22
阅读次数:
121
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
题意:给一个有序的链表建立二叉搜索树。
思路:这里是先递归建立左子树,然后链表跟着移动,左子树建立完了,此时节点就到了根了,接着建立右子树。
/**
* Definit...
分类:
其他好文 时间:
2015-05-06 13:19:54
阅读次数:
85
我们知道qmake是Qt最原生的跨平台编译工具。由于一些原因,在Ubuntu手机14.10上,广泛使用CMake以跨不同平台。事实上,在Qt Creator上,如果我们使用qmake,我们可以更加方便地管理我们的项目。比如:
-我们可以在项目中使用点击右鼠标键来添加或删除文件。在CMake项目中,我们只能进行添加的动作
-在新的模版中加入了使用“main()”的入口,这样可以很方便地让我们的项目编译成为binary。对那些希望把自己的代码进行保护的开发者来说,这无疑是个好的方案
-对文件的部署来说,qma...
分类:
系统相关 时间:
2015-05-06 13:17:43
阅读次数:
156
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
其他好文 时间:
2015-05-06 13:09:34
阅读次数:
88
Binary Tree Right Side ViewGiven a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered fr...
分类:
其他好文 时间:
2015-05-06 12:33:09
阅读次数:
111
题目:Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".代码:class Solution {public: string addBina...
分类:
其他好文 时间:
2015-05-06 10:53:29
阅读次数:
107