要搜索的对象是一个rotated sorted array,所以从直觉上时间复杂度应该不会超过O(logn)。起初我想尝试修改binary search来解决这个问题,但仔细思考后发现在不断search的过程中,search的boundary是比较难确定的。解决这个题目的另一个思路就是先把pivot...
分类:
其他好文 时间:
2014-08-02 15:21:23
阅读次数:
359
问题:二叉树中序遍历递归实现/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) :...
分类:
其他好文 时间:
2014-08-02 12:40:33
阅读次数:
162
题目: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
textField:文本框,文本域。undock:移除。statistics:统计。config:配置。model:模型。auth:认证。decimal:十进制。hexadecimal:十六进制。octal:八进制。binary:二进制。warning=caution:警告。epsilon:极小值。...
分类:
其他好文 时间:
2014-08-02 05:01:35
阅读次数:
248
题目链接:点击打开链接
思路:
我们首先假设这个图都是全0的
用n个点代表行,m个点代表列
用源点向行连一个值x 表示每行1的个数,向列连一个y表示每列y个1
则若行i和列j之间流过一个流量就表示 (i,j) 点填了1
那么若原来图中(i,j)点为0 则花费就是1
若原图中(i,j)点是1,则花费是-1
如此枚举x跑个费用流就好了
==居然把我多年的白书费用流坑掉了。。。
zk...
分类:
其他好文 时间:
2014-08-01 23:15:42
阅读次数:
313
问题:二叉树的最深深度class Solution{public: void dfs(TreeNode *root,int step,int &MAX) { if(root==NULL) { if(MAXleft,step+1); ...
分类:
其他好文 时间:
2014-08-01 22:49:02
阅读次数:
202
#include using namespace std;int a[1000];int f(int n){ int k=0; while(n) { a[k++]=n%2; n/=2; } return k;}int main(int argc, char *argv[]){ int n,m,...
分类:
其他好文 时间:
2014-08-01 22:45:22
阅读次数:
248
环境windows2012java7u65mysql5.1所有安装都是默认的没有更改过目录下载6.03http://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-6.0.3-x32.exe下载mysql-connector-java-5.1.31-bin.jar安装jira6.03停止jira服务拷贝mysql-connector-java-5.1.31-bin.jar..
分类:
数据库 时间:
2014-08-01 20:21:02
阅读次数:
441
Given inorder and postorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
/**
* Definition for binary tree
* struct TreeNode {...
分类:
其他好文 时间:
2014-08-01 19:53:32
阅读次数:
222
Description
Background
Binary trees are a common data structure in computer science. In this problem we will look at an infinite binary tree where the nodes contain a pair of integers. Th...
分类:
其他好文 时间:
2014-08-01 19:39:52
阅读次数:
207