bfs+优先队列。wa了N次,才发现可以停留等待楼梯变换方向。 1 #include 2
#include 3 #include 4 #include 5 using namespace std; 6 7 #define MAXNUM 55 8 9
typedef struct node...
分类:
其他好文 时间:
2014-06-03 13:26:06
阅读次数:
274
BFS+优先级队列。 1 #include 2 #include 3 #include 4
#include 5 using namespace std; 6 7 #define MAXNUM 205 8 9 typedef struct
node_st {10 int x, y...
分类:
其他好文 时间:
2014-06-03 06:50:09
阅读次数:
259
图的数组表示法借助一个二维数组表示图,该二维数组的第i行,第j列的值表示从Node[i]到Node[j]:无向图(网):是否有边 / 权值,arr[i][j]
== arr[j][i],无向图(网)的特性,矩阵关于对角线对称。有向图(网):是否有弧 / 权值。//图的数组表示法//最大顶点个数con...
分类:
其他好文 时间:
2014-05-30 21:56:24
阅读次数:
394
题目描述:输入一个链表,反转链表后,输出链表的所有元素。(hint :
请务必使用链表)输入:输入可能包含多个测试样例,输入以EOF结束。对于每个测试案例,输入的第一行为一个整数n(0next也就是p1来改变p1元素的位置,代码如下:Node
*p = head->next; Node *p1...
分类:
其他好文 时间:
2014-05-30 21:55:06
阅读次数:
349
Follow up for problem "Populating Next Right
Pointers in Each Node".What if the given tree could be any binary tree? Would
your previous solution stil...
分类:
其他好文 时间:
2014-05-30 16:17:49
阅读次数:
210
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-05-30 16:10:54
阅读次数:
185
Given a linked list, return the node where the
cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it
without using extra space?/**...
分类:
其他好文 时间:
2014-05-30 15:59:56
阅读次数:
249
A linked list is given such that each node
contains an additional random pointer which could point to any node in the list
or null.Return a deep copy ...
分类:
其他好文 时间:
2014-05-30 15:07:49
阅读次数:
260
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 le...
分类:
其他好文 时间:
2014-05-30 15:03:42
阅读次数:
237
不同的编程语言都有各自的代码组织和复用的方式,如.net、php中的命名空间,python中的import,ruby中的module等,来避免命名空间污染。一直都没搞清楚node中的exports和module.exports的区别,借此搞清楚node的代码模块复用方式。首先怎么创建node中的mo...
分类:
Web程序 时间:
2014-05-30 14:47:27
阅读次数:
236