简单题:先按左左边排序,然后对输入的区间和当前结果合并 1 /** 2 * Definition for an interval. 3 * struct Interval { 4 * int start; 5 * int end; 6 * Interval() : ...
分类:
其他好文 时间:
2014-08-09 21:25:19
阅读次数:
205
问题描述:输入一个单向链表,输出该链表中倒数第k个结点。链表倒数第0个节点为NULL。struct list_node { int data; list_node* next;};分析:方法1:首先计算出链表中节点的个数n,然后倒数第k个节点,为正数n-k+1个节点。需要遍历链表2次。方...
分类:
其他好文 时间:
2014-08-09 21:24:29
阅读次数:
254
#include #include using namespace std;const int N=100;const int M=100;typedef struct //定义迷宫结构 { char c; short int p_row,p_col,step;}Maze; Maze a[N][.....
分类:
其他好文 时间:
2014-08-09 21:20:19
阅读次数:
382
聚合类聚合类使得用户可以直接访问其成员,并且具有特殊的初始化语法形式。当一个类满足如下条件时,我们说它是聚合的:所有成员都是public的没有定义任何构造函数没有类内初始化没有基类,也没用virtual函数。下面的类都是一个聚合类struct Data{ int ival; string s;}.....
分类:
其他好文 时间:
2014-08-09 21:04:49
阅读次数:
237
用户态对accept的标准使用方法:if ((client_fd = accept(sockfd, (struct sockaddr *)&remote_addr, &sin_size)) == -1) { //accept()函数让server接收客户的连接请求 perror("acce...
分类:
其他好文 时间:
2014-08-09 18:40:18
阅读次数:
323
58.从尾到头输出链表(链表)。题目:输入一个链表的头结点,从尾到头反过来输出每个结点的值。链表结点定义如下:struct ListNode{int m_nKey;ListNode* m_pNext;};我的思路:用一个数组存起来已有的数字,再反过来输出。缺点是数组大小是确定的 链表长度不能超过数....
分类:
其他好文 时间:
2014-08-09 18:39:00
阅读次数:
258
1 #include 2 using namespace std; 3 const int N=3000; 4 struct SubNode 5 { 6 int left,right; 7 int value; 8 } 9 struct Node10 {11 int lef...
分类:
其他好文 时间:
2014-08-09 18:30:18
阅读次数:
191
#include
#include
#define N 8
typedef struct list
{
int data;
struct list *next;
}SLIST;
SLIST *creatlist(int *);
void outlist(SLIST *);
int fun(SLIST *h)
{
SLIST *p;int s=0;
p=h->next;
while(p)
...
分类:
其他好文 时间:
2014-08-09 13:32:57
阅读次数:
297
进程的管理与调度
进程管理
进程描述符及任务结构
进程存放在叫做任务队列(tasklist)的双向循环链表中。链表中的每一项包含一个具体进程的所有信息,类型为task_struct,称为进程描述符(process descriptor),该结构定义在文件中。
Linux通过slab分配器分配task_struct结构,这样能达到对象复用和缓存着色(cache colorin...
分类:
系统相关 时间:
2014-08-09 13:29:07
阅读次数:
993
邻接表using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace LH.GraphConsole{ public struct AdjacencyListGraph ...
分类:
其他好文 时间:
2014-08-09 13:18:07
阅读次数:
199