typedef struct ListNode{
int data;
struct ListNode *next;
}ListNode;
//递归一
ListNode *ReverseList (ListNode *pHead, ListNode *nHead = NULL)
{
//每次取下第一个节点头插法创建新链表
//nHead为反转后链表的头节点
if(pHead == NUL...
分类:
其他好文 时间:
2014-08-05 19:36:50
阅读次数:
241
对于一颗二叉树,可以根据先序遍历(后序遍历)和中序遍历重新还原出二叉树。
主要通过递归实现。
关键是找出对应左右子树的长度,之后传递先序遍历的开始节点、结束节点,中序遍历的开始节点、结束节点。
代码:
#include
using namespace std;
typedef struct tree{
int data;
struct tree *lchild;
struct ...
分类:
其他好文 时间:
2014-08-05 19:27:30
阅读次数:
224
#include #include - (NSString *)getIPAddress{NSString *address = @"error";struct ifaddrs *interfaces = NULL;struct ifaddrs *temp_addr = NULL;int succe...
分类:
移动开发 时间:
2014-08-05 19:15:49
阅读次数:
185
HDU 2222 题意:给出N(N#include #include using namespace std;#define N 500005char str[1000005];struct AC{ int ch[N][26],fail[N],val[N],last[N],tmp,root; ...
分类:
其他好文 时间:
2014-08-05 18:39:09
阅读次数:
246
方法一:(msdn)#include #include #include #include #include #pragma comment(lib,"netapi32.lib")typedef struct _ASTAT_{ ADAPTER_STATUS adapt; NAME_BUFF...
分类:
其他好文 时间:
2014-08-05 18:19:49
阅读次数:
218
附属脚本是访问对象,集合或序列的快捷方式struct STest{ let constValue:Int subscript(count:Int)->Int{ return count*constValue }}let obj = STest(constValue:3...
分类:
其他好文 时间:
2014-08-05 18:12:19
阅读次数:
204
typedef struct node{ int count; struct node *next[MAX];}Trie;Trie *Newnode()//建立结点&初始化a{ int i; Trie *T; T = (Trie *)malloc(sizeof(Trie...
分类:
其他好文 时间:
2014-08-05 18:12:09
阅读次数:
201
在整理Java LockSupport.park()的东东,看到了个"Spurious wakeup",重新梳理下。
首先来个《UNIX环境高级编程》里的例子:
[cpp] view
plaincopy
#include
struct msg {
struct msg *m_next;
/* ... mo...
分类:
其他好文 时间:
2014-08-05 15:53:01
阅读次数:
369
U-boot会给Linux Kernel传递很多参数,如:串口,RAM,videofb等。而Linux kernel也会读取和处理这些参数。两者之间通过struct tag来传递参数。U-boot把要传递给kernel的东西保存在struct tag数据结构中,启动kernel时,把这个结构体的物理...
分类:
系统相关 时间:
2014-08-05 13:20:19
阅读次数:
507
#include
#include
#include
/*
有符号 结构体1
*/
struct bits
{
int b1:5;
/*
因为是int型,最大设置32位,由于int型是有符号整形,
所以这里5位为有符号类型。
11111 -1
10000 -16
01111 15
00000 0
*/
int :2;
int b2:2;
/*
11 -1
10 -2
01 1
0...
分类:
其他好文 时间:
2014-08-05 11:20:09
阅读次数:
205