Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe...
分类:
其他好文 时间:
2014-06-19 11:23:05
阅读次数:
204
表(list)是常见的数据结构。从数学上来说,表是一个有序的元素集合。在C语言的内存中,表储存为分散的节点(node)。每个节点包含有一个元素,以及一个指向下一个(或者上一个)元素的指针。如下图所示:表:
橙色储存数据,蓝色储存指针图中的表中有四个节点。第一个节点是头节点(head node),这个...
分类:
其他好文 时间:
2014-06-16 00:20:12
阅读次数:
308
用java开发的socket.io,用户node.js作为服务器端,作用就是同步同步,比如开发网站的时候,当用户登录之后,可以实现当前浏览器多个窗口的页面都是登录后的效果。首先需要安装socket.io,以及所需要的模块, 在项目里引用socket.io的js包, java代码构建socket.io...
分类:
编程语言 时间:
2014-06-15 23:54:11
阅读次数:
637
Socket.IO 是目前 Web 领域最火的实时引擎,用于实现基于事件的双向实时的通信。它适用于任何平台,浏览器或设备,专注于可靠性和速度。您可以将数据推送到客户端,并获得实时的计数,日志或图表。这是 GitHub 上最强大的 JavaScript 框架之一,Node.js 开发必备。
分类:
其他好文 时间:
2014-06-15 23:20:05
阅读次数:
282
笔者在调用Google Calendar APIs的GetColors过程当中(具体关于Google Calendar API已经Google API的介绍请见我其他的博文,当前我们只是拿Google Calendar API返回的结果举一个例子),JSON返回的数据中,出现了以数字作为键(key)的数据;但是因为我们在企业应用集成中,有时候需要把JSON数据转换成XML数据;那么这个时候,JSON数据中的键(key)映射到XML数据中将成为XML数据的节点名字(Node Name),如果JSON中的键(k...
分类:
编程语言 时间:
2014-06-15 18:43:27
阅读次数:
294
O(1)时间内删除结点的思路只能是复制该结点下一个结点的数据,然后删除该结点的下一个结点,来等效删除此结点。需要注意的地方是删除头结点和尾结点的处理。 1 #include 2 #include 3 #include 4 typedef struct Node 5 { 6 int da...
分类:
其他好文 时间:
2014-06-15 17:05:10
阅读次数:
107
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
此题和求二叉树的最短路径几乎一模一样。
public int...
分类:
其他好文 时间:
2014-06-15 16:36:40
阅读次数:
209
这一题不会做啊……我觉得真要比赛的话我可能会随机上几万次,然后再用LCA求距离,更新最优值,等到快超时的时候输出答案……题解请看2007年陈瑜希论文代码: 1
const maxn=400100; 2 type node=record 3 w,go,next:longint; 4 ...
分类:
其他好文 时间:
2014-06-13 18:19:27
阅读次数:
205
#include #include int map[51][51][51];int
v[51][51][51];int a,b,c,t11;struct node{ int x,y,z,ans;}q[200001];int
jx[6]={0,0,0,0,-1,1};int jy[6]={0,0...
分类:
其他好文 时间:
2014-06-13 17:10:39
阅读次数:
157
这个比较简单,用栈、递归、倒转链表都可以实现,不再过多解释。代码使用递归实现 1
#include 2 #include 3 #include 4 typedef struct Node 5 { 6 int data; 7 Node*
next; 8 }Node, *List;...
分类:
其他好文 时间:
2014-06-13 15:25:59
阅读次数:
194