码迷,mamicode.com
首页 >  
搜索关键字:binary tree right si    ( 32903个结果
codeforces431C - k-Tree DP
题意:给你一个K叉数,每个节点都一定有K 个子节点,且到这K个子节点的费用为1-k,问你 费用总和为n且最少需要走过一条 d-k的边的概率解题思路:分成两个二维DP,一个表示没有走过的,一个表示走过的,即可dp求出解题代码: 1 /**********************************...
分类:其他好文   时间:2014-08-02 17:55:34    阅读次数:170
LeetCode——Unique Binary Search Trees
Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \ ...
分类:其他好文   时间:2014-08-02 15:34:34    阅读次数:221
Search in Rotated Sorted Array I
要搜索的对象是一个rotated sorted array,所以从直觉上时间复杂度应该不会超过O(logn)。起初我想尝试修改binary search来解决这个问题,但仔细思考后发现在不断search的过程中,search的boundary是比较难确定的。解决这个题目的另一个思路就是先把pivot...
分类:其他好文   时间:2014-08-02 15:21:23    阅读次数:359
B - Georgia and Bob
Description Georgia and Bob decide to play a self-invented game. They draw a row of grids on paper, number the grids from left to right by 1, 2, 3, ..., and place N chessmen on different grid...
分类:其他好文   时间:2014-08-02 12:56:13    阅读次数:312
Nearest Common Ancestors·POJ1330
传送门:http://poj.org/problem?id=1330Nearest Common AncestorsTime Limit: 1000MSMemory Limit: 10000KDescriptionA rooted tree is a well-known data structur...
分类:其他好文   时间:2014-08-02 12:46:23    阅读次数:356
Binary Tree Inorder Traversal
问题:二叉树中序遍历递归实现/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) :...
分类:其他好文   时间:2014-08-02 12:40:33    阅读次数:162
PAT---1005. Spell It Right (20)
#include#include#includechar *g_WordTable[10]= {"zero", "one", "two", "three", "four", "five","six", "seven", "eight", "nine"};int main(){ //存放用户输入...
分类:其他好文   时间:2014-08-02 12:31:53    阅读次数:530
Unique Paths leetcode java
题目: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at a....
分类:编程语言   时间:2014-08-02 12:17:23    阅读次数:279
Binary Tree Maximum Path Sum leetcode java
题目:Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1...
分类:编程语言   时间:2014-08-02 09:50:13    阅读次数:232
2014年7月
textField:文本框,文本域。undock:移除。statistics:统计。config:配置。model:模型。auth:认证。decimal:十进制。hexadecimal:十六进制。octal:八进制。binary:二进制。warning=caution:警告。epsilon:极小值。...
分类:其他好文   时间:2014-08-02 05:01:35    阅读次数:248
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!