嘎唔!~又一次POJ过了HDU错了。。。不禁让我想起前两天的的Is it a tree? orz。。这次竟然错在HDU一定要是多组数据输入输出!(无力吐槽TT)。。题目很简单,炒鸡水!题意:告诉你每个村庄之间的距离,和几组已经联通的村庄,求使所有村庄联通所要建的道路的最短距离。很简单,用最小生成.....
分类:
其他好文 时间:
2014-07-21 00:11:36
阅读次数:
324
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; ...
分类:
其他好文 时间:
2014-07-21 00:11:12
阅读次数:
254
点击后形成扩散圈这个名字有点奇怪,就是在一个div被点击后,会形成一个圈,往外扩散,直至塞满整个div。效果看这:http://codepen.io/crab/pen/aAbvf具体的实现就是在被点击的div中加入svg,然后其中的circle不断扩大,最后remove掉。在这里用了jquery库。...
分类:
其他好文 时间:
2014-07-21 00:08:06
阅读次数:
294
这里讲讲对binary Tree 进行level order Traversal.。 即BF traversal(广度优先遍历)。即首先, 访问根节点F, 打印出数据。 接着访问level 1的所有节点, 即D, J。 访问完level1之后, 访问level2, 即B, E, G , K 等等一次访问下去, 直至遍历完所有的节点。
BFS遍历的思路很简单, 但是当我们编程实现的时候,...
分类:
编程语言 时间:
2014-07-20 23:11:21
阅读次数:
344
URL编码总结
URL是Universal Resource Locator的简称,翻译过来那就是统一资源定位符,好吧,我们经常会俗称为网页地址。一个URL的格式通常是这样的:
协议类型://服务器地址(必要时需加上端口号)/路径/文件名?参数,比如http://zh.wikipedia.org:80/w/index.php?title=Special,协议是HTTP,服务...
分类:
其他好文 时间:
2014-07-20 23:05:29
阅读次数:
299
如下图:
这里我们实现DFS中的三种遍历方法。
相关的如下:
相关算法的介绍不再赘述。
首先对于preorder traversal 的步骤为:
其他两种算法略。
具体递归调用分析, 注意学会画stack frame的图分析。 这里不再赘述。
代码如下:
/* Binary Tree Traversal - Preorder, Inorder, Postor...
分类:
编程语言 时间:
2014-07-20 23:05:10
阅读次数:
365
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...
分类:
其他好文 时间:
2014-07-20 22:41:23
阅读次数:
303
//打开本包内asset目录下的index.html文件
wView.loadUrl(" file:///android_asset/index.html ");
//打开本地sd卡内的index.html文件
wView.loadUrl("content://com.android.htmlfileprovider/sdcard/index.html");
//打开指定UR...
分类:
Web程序 时间:
2014-07-20 22:38:53
阅读次数:
221
#include
#include
#include
using namespace std;
struct CNode
{
int L,R;
CNode* pLeft,* pRight;
long long Inc;
long long nSum;
};
CNode Tree[200010];
int nCount=0;
int Mid(CNode* pRoot)...
分类:
其他好文 时间:
2014-07-20 22:38:44
阅读次数:
245
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 identical and the nodes have the same value.
比较两个...
分类:
编程语言 时间:
2014-07-20 22:12:03
阅读次数:
273