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
linux下常用时间类型有四种: time_t 、 struct tm、 struct timeval
、 struct timespec1、time_t 时间函数 time_t 类型在time.h中定义: #ifndef __TIME__T #define
__TIME_...
分类:
系统相关 时间:
2014-05-30 23:18:32
阅读次数:
467
这个结构从list.h 移到了types.h,
可见内核对循环链表的重视include/linux/types.h中定义struct list_head { struct list_head *next,
*prev;};include/linux/list.h 中的宏初始化 一个叫name的链表节...
分类:
系统相关 时间:
2014-05-30 23:10:13
阅读次数:
412
Givennpoints on a 2D plane, find the maximum
number of points that lie on the same straight line./** * Definition for a
point. * struct Point { * ...
分类:
其他好文 时间:
2014-05-30 16:27:19
阅读次数:
238
Given a binary tree struct TreeLinkNode {
TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next
pointe...
分类:
其他好文 时间:
2014-05-30 15:21:20
阅读次数:
181
Sort a linked list inO(nlogn) time using
constant space complexity./** * Definition for singly-linked list. * struct
ListNode { * int val; * L...
分类:
其他好文 时间:
2014-05-30 15:17:18
阅读次数:
312
Sort a linked list using insertion sort./** *
Definition for singly-linked list. * struct ListNode { * int val; * ListNode
*next; * ListNo...
分类:
其他好文 时间:
2014-05-30 15:14:27
阅读次数:
245
Given an array where elements are sorted in
ascending order, convert it to a height balanced BST./** * Definition for binary
tree * struct TreeNode { ...
分类:
其他好文 时间:
2014-05-30 15:10:23
阅读次数:
227
Queue
简单而实用的数据结构,FIFO,通过循环数组避免队列出现“似乎满了”的现象。package Queueimport "errors"const (
defaultQueueSize=10)var queueSize inttype MyQueue struct{ front...
分类:
其他好文 时间:
2014-05-30 00:48:43
阅读次数:
284
题目描述:输入一个链表,输出该链表中倒数第k个结点。(hint:
请务必使用链表。)输入:输入可能包含多个测试样例,输入以EOF结束。对于每个测试案例,输入的第一行为两个整数n和k(0#include typedef
struct node{ int number; struct nod...
分类:
其他好文 时间:
2014-05-30 00:29:13
阅读次数:
325