1 递归,很简单
代码:
#include
using namespace std;
typedef struct node{
int data;
struct node * pNext;
}Node ,*pNode;
void createNode(pNode & pHead){
int temp;
scanf("%d",&temp);
pNode p,q;
boo...
分类:
其他好文 时间:
2014-08-08 21:28:56
阅读次数:
314
内存管理
页
内核把物理页作为内存管理的基本单位;内存管理单元(MMU,管理内存并把虚拟地址转换为物理地址)通常以页为单位进行处理。MMU以页大小为单位来管理系统中的页表。从虚拟内存的角度看,页就是最小单位。
32位系统:页大小4KB
64位系统:页大小8KB
在支持4KB页大小并有1GB物理内存的机器上,物理内存会被划分为262144个页。内核用 struct page 结构表示系统中...
分类:
系统相关 时间:
2014-08-08 21:25:26
阅读次数:
496
1.判断一个链表是否存在环,例如下面这个链表就存在一个环:例如N1->N2->N3->N4->N5->N2就是一个有环的链表c语言版: 1 #include 2 #include 3 4 struct link{ 5 int data; 6 struct link *next;...
分类:
其他好文 时间:
2014-08-08 21:10:56
阅读次数:
272
#include#include#include#includeusing namespace std;struct point{ int x,y,step;}p;string map[211];int used[211][211];int f[4][2] = {{1,0},{0,1}...
分类:
其他好文 时间:
2014-08-08 20:49:36
阅读次数:
228
顺序队列是一段连续的地址,但是存在假溢出情况,所以要用循环队列来实现,具体操作像钟表下面是顺序队列的表示与实现:#include using namespace std;//顺序循环队列的基本表示和实现const int MAX_SIZE = 100;//定义队列长度struct SqQueue{ ...
分类:
其他好文 时间:
2014-08-08 17:57:26
阅读次数:
205
模版代码:#include#include#includeusing namespace std;struct node{ friend bool operator qi; for(i = 0; i , greater >qi2; for(i = 0; i qn; node...
分类:
其他好文 时间:
2014-08-08 17:54:56
阅读次数:
246
struct point{ double x,y,angel;} p[N],stack[N];int top,n;double dis(point a,point b)//求距离{ return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));...
分类:
其他好文 时间:
2014-08-08 17:38:46
阅读次数:
248
队列,是一种先进先出的线性表,它只允许在队头删除,在队尾插入,链式队列和单链表操作类似,但是有队首指针和队尾指针,下面是链式队列的表示和实现:#include using namespace std;//队列的链式表现与实现struct QNode{ int data; QNode *n...
分类:
其他好文 时间:
2014-08-08 17:37:06
阅读次数:
257
1 //线段树数组静态模板 2 3 4 #include 5 #include 6 #define MAX 50003 7 #define ll long long 8 9 using namespace std;10 11 struct node12 {13 int w;14 ...
分类:
其他好文 时间:
2014-08-08 17:34:56
阅读次数:
259
定义一颗字典树:
struct Trie
{
int n; // n可以存储相关有用信息,视情况而定
Trie *next[maxn]; //maxn视字典树中有多少种元素而定
}
定义字典树的根并初始化:
Trie *root;
void init()
{
root = (Trie *)malloc(sizeof(Trie));
root ->...
分类:
其他好文 时间:
2014-08-08 16:03:16
阅读次数:
170