链表中结点的分配和回收是由系统提供的标准函数malloc和free动态实现的,称之为动态链表。
如果程序支持指针,则可按照我们的一般形式实现链表, 需要时分配,不需要时回收即可.
动态链表的空间是可以动态扩展的。
typedef struct node{
EleType data;
struct node * pNext;
}Node;
有些高级语言中没有“指...
分类:
其他好文 时间:
2014-05-10 10:38:07
阅读次数:
297
ISO C标准I/O库使用流的概念读写文件。流是对数据传输的抽象,可以把流理解为从起点到终点间的字节序列。
标准I/O库通过维护进程空间内的缓冲区,减少read/write系统调用次数来提高I/O效率。之前介绍的Unbuffered I/O和文件描述符fd打交道,标准I/O则使用FILE指针。
typedef struct{
short level;/*缓冲区满程度*/
uns...
分类:
其他好文 时间:
2014-05-10 09:37:37
阅读次数:
388
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4720
用几何模板,求外接圆,再判断点在不在圆内
#include
#include
#include
const double esp = 1e-9;
//点
struct Point {
double x, y;
Point() {}
Point(double x...
分类:
其他好文 时间:
2014-05-10 08:52:52
阅读次数:
336
题目来源:HDU 1542 Atlantis
题意:给你一些矩形(左下角和右上角)求面积
思路:参考here这个超赞的 一看就懂了
#include
#include
#include
#include
using namespace std;
const int maxn = 210;
struct node
{
double l, r, h;
int s, val;
nod...
分类:
其他好文 时间:
2014-05-07 08:59:09
阅读次数:
395
常见系统数据文件
下表列出了常见的系统数据文件及其查找函数。
以/etc/passwd文件为例,读取数据的程序框架如下:
void get_pw_entry()
{
struct passwd *ptr;
setpwent();
while ((ptr = getpwent()) != 0) {
……
}
endpwe...
分类:
其他好文 时间:
2014-05-07 08:46:54
阅读次数:
341
简单的说,i2c驱动也就三步吧,注册i2c设备,注册i2c设备驱动,创建sysfs文件供上层调用。
1. 注册i2c设备。
先定义一个i2c_board_info
static struct i2c_board_info __initdata xxxx_i2c_info[] = {
{
I2C_BOARD_INFO("XXX...
分类:
其他好文 时间:
2014-05-07 08:34:39
阅读次数:
333
题目大意:
添加和删除一个数,然后输出中位数。
简单的Splay 维护Splay上有多少个节点就可以了
#include
#include
#define inf 1LL<<60
#define maxn 222222
#define keyTree (ch[ch[root][1]][0])
using namespace std;
typedef long...
分类:
其他好文 时间:
2014-05-07 07:46:42
阅读次数:
405
题意:所有n个人围成一个圈,
#include
#include
struct Node
{
int data;
Node *next;
Node *prior;
};
Node* CreateList(Node* &head, int n);
Node* searchk(Node *ptr, Node* &head, int k);
Node* rsearchm(Node...
分类:
其他好文 时间:
2014-05-07 06:26:28
阅读次数:
327
最近看boost的时候总是遇见这个eval_if,不知道啥意思,就没法看下去了,比如
前篇文章boost::serialization 拆分serialize函数分析时就出现这样一段代码:
template
inline void split_member(Archive & ar, T & t, const unsigned int file_version)
{
typedef BOOS...
分类:
其他好文 时间:
2014-05-07 06:21:14
阅读次数:
556