出题:反转链表(递归和非递归解法);分析:有递归跟非递归实现,注意对原始链表头节点的处理,因为其他节点都指向下一个节点,其需要指向NULL;解题: 1
struct Node { 2 int v; 3 Node *next; 4 }; 5 Node* NonRecur...
分类:
其他好文 时间:
2014-05-22 05:20:04
阅读次数:
310
《对话LinusTorvalds:大多黑客甚至连指针都未理解》http://www.csdn.net/article/2013-01-10/2813559-two-star-programming“不懂指针”的开发者代码示例:
1 typedef struct node 2 { 3 ...
分类:
其他好文 时间:
2014-05-22 04:40:17
阅读次数:
245
需求单链表不可以用下标直接得到中间位置,可以采取一前一后(前面的走2步,后面的走一步)的方式实现。参考代码1 struct ListNode { int
val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} ...
分类:
其他好文 时间:
2014-05-22 00:52:25
阅读次数:
376
#include
#include
#include
#define STACK_INIT_SIZE 100
#define STACKINCREMENT 10
#define OVERFLOW -1
#define OK 1
#define ERROR 0
typedef int Status;
typedef int SElemType;
typedef struct
{...
分类:
其他好文 时间:
2014-05-21 16:31:38
阅读次数:
215
#include
#include
typedef int elemType;
typedef struct Node{//定义单链表节点类型
elemType data;
Node *next;
}Node,*linkList;
//初始化链表,单链表的头指针为空
int initList(linkList &L)
{
L= (Node *)malloc(sizeof(Node));...
分类:
其他好文 时间:
2014-05-21 11:19:08
阅读次数:
228
之前用过uip作为udp使用,但将它作为server还没有涉及到,最近有个小项目中需要使用。以下针对它作为tcp_server流程测试和探索。
struct timer periodic_timer, arp_timer;
//struct uip_udp_conn myUdp_Con;
//struct uip_udp_conn *pMyUpd_Con;
//...
分类:
其他好文 时间:
2014-05-21 08:51:30
阅读次数:
490
Tour
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 3470
Accepted: 1545
Description
John Doe, a skilled pilot, enjoys traveling. While on vacation, he rents a...
分类:
其他好文 时间:
2014-05-21 08:24:18
阅读次数:
354
POSIX消息队列相关函数:
mq_open函数
功能:用来创建和访问一个消息队列
原型
mqd_t mq_open(const char *name, int oflag);
mqd_t mq_open(const char *name, int oflag, mode_t mode, struct mq_attr *attr);
参数
name: 某个消息队列...
分类:
其他好文 时间:
2014-05-21 06:35:08
阅读次数:
316
一张图上分布着n台坏了的电脑,并知道它们的坐标。两台修好的电脑如果距离
#include
#include
#include
#include
#include
#include
const int MAXN=111111;
const int MAX_N=111111;
int n,d;
using namespace std;
struct po
{
int x,y;
boo...
分类:
Web程序 时间:
2014-05-21 06:29:47
阅读次数:
418
#include#include#includetypedef int Item;typedef
struct node* PNode;typedef struct node{ Item data; PNode next;}Node;typedef
struct{ PNode fr...
分类:
其他好文 时间:
2014-05-21 04:20:54
阅读次数:
219