https://oj.leetcode.com/problems/maximum-depth-of-binary-tree/Given a binary tree, find its maximum depth.The maximum depth is the number of nodes alo...
分类:
其他好文 时间:
2015-01-13 14:13:55
阅读次数:
105
Follow up for "Search in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Write a function to determine if a given target is in the...
分类:
其他好文 时间:
2015-01-13 12:33:11
阅读次数:
118
静态查找表顺序查找有序查找折半查找(binary search)判定树 折半查找只适用于有序表,且限于顺序存储结构(对线性链表无法有效的进行折半查找)斐波那契查找:根据斐波那契序列的特点进行分割,假设开始时表中记录个数比某个斐波那契数小1即n=fu-1,然后将给定值key和 [fu -1 ].key...
分类:
其他好文 时间:
2015-01-13 07:50:39
阅读次数:
243
Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ...
分类:
编程语言 时间:
2015-01-13 06:42:51
阅读次数:
201
描述GiventwostringsAandB,whosealphabetconsistonly‘0’and‘1’.YourtaskisonlytotellhowmanytimesdoesAappearasasubstringofB?Forexample,thetextstringBis‘1001110110’whilethepatternstringAis‘11’,youshouldoutput3,becausethepatternAappearedattheposit输入Thefir..
分类:
其他好文 时间:
2015-01-13 01:33:32
阅读次数:
132
二叉搜索树,也叫二叉排序树、二叉查找树或BST(Binary Search Tree)。二叉搜索树或是一棵空疏,或者是一棵具有下列特性的非空二叉树:1. 若左子树非空,则左子树上的所有节点的关键字值均小于根节点的关键字的值。2. 若右子树非空,则右子树上的所有节点的关键字值均大于根节点的关键字的值。...
分类:
其他好文 时间:
2015-01-12 22:29:06
阅读次数:
206
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 / \ 2 2 /...
分类:
移动开发 时间:
2015-01-12 22:25:01
阅读次数:
151
Follow up for "Find Minimum in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Suppose a sorted array is rotated at some pivot u...
分类:
其他好文 时间:
2015-01-12 21:04:07
阅读次数:
224
题目:
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For example:
Given the below binary tree and sum
= 22,
5
/...
分类:
编程语言 时间:
2015-01-12 19:24:15
阅读次数:
170
Given two binary strings, return their sum (also a binary string).
For example,
a = "11"
b = "1"
Return "100".
class Solution
{
public:
string addBinary(string a, string b)
{
...
分类:
其他好文 时间:
2015-01-12 17:43:48
阅读次数:
138