下列语句哪一个正确( )
A. Java程序经编译后会产生machine code
B. Java程序经编译后会产生byte code
C. Java程序经编译后会产生DLL
D. 以上都不正确答案:B...
分类:
其他好文 时间:
2015-04-23 00:04:54
阅读次数:
144
求二叉树深度。【思路】很简单,二叉树经典。用递归求左树右树的深度,较大值加1即可。【other code】int maxDepth(TreeNode *root) { if(root==NULL) return 0; //if(maxDepth(ro...
分类:
其他好文 时间:
2015-04-22 23:53:08
阅读次数:
165
要求:在之前编写的四则运算程序基础之上做如下改进:1 请参照教材Page57:4.2-4.3节中内容,修改原程序,使之符合 “代码风格和设计规范”的基本要求;2 请采用模块化设计思想,修改之前的code,将 “计算功能” 封装起来3 通过测试程序和API 接口,测试其简单的加法功能。4 扩展程序功能...
分类:
其他好文 时间:
2015-04-22 23:50:50
阅读次数:
183
题意:
最大生成树
思路:
最大生成树
code:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define eps ...
分类:
其他好文 时间:
2015-04-22 22:16:42
阅读次数:
120
题意:
给一棵n个节点连通的树
条件 : 去掉一个节点 使剩下的每个连通分量 都不超过n/2个节点
让找出所有符合上述条件的点 按照从小到大的顺序输出
思路:
首先建树
然后在建树的过程中,统计每个节点的子树中 最多的节点个数
同时统计以此结点为根的树的 节点总数 sum[i]
可以根据 n - sum[i] 算出上面一个祖先连通分量的节点个数
判断即可
code:...
分类:
其他好文 时间:
2015-04-22 22:13:58
阅读次数:
141
leet code Sort Listleet code Sort List对链表使用快慢指针归并排序Sort ListSort a linked list in O(n log n) time using constant space complexity./** * Definition for...
分类:
其他好文 时间:
2015-04-22 22:12:40
阅读次数:
123
1 题目Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identica...
分类:
其他好文 时间:
2015-04-22 22:06:33
阅读次数:
189
Building from sourceDownload latest version of procbuffer. [https://code.google.com/p/protobuf/downloads/list].e.g "wget https://protobuf.googlecode.c...
分类:
系统相关 时间:
2015-04-22 22:01:08
阅读次数:
398
题意:
给n个区间 选择尽量少的区间 覆盖1~T这个区间
如果不能覆盖 输出-1
思路:
经典贪心 区间覆盖
将所有区间按照起点从小到大排序 取终点在最右边的那个区间
code:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namesp...
分类:
其他好文 时间:
2015-04-22 20:39:20
阅读次数:
114
2015-03-06 328 Unusual Data Types ——You can carry this technique to extremes,putting all the variables in your program into one big,juicy variable an....
分类:
其他好文 时间:
2015-04-22 20:16:19
阅读次数:
183