码迷,mamicode.com
首页 >  
搜索关键字:struct    ( 18973个结果
实现自己的软件定时器
为什么要实现软件定时器: 在芯片上,地址空间也是相当宝贵的,如果保留了更多的硬件定时器的话,就需要更多的地址空间,那么我们能不能作个折中方案呢?答案是肯定的,我们可以使用一个硬件定时器,来模拟实现一个软件定时器,可以满足更多的定时需求,需要注意的一点就是软件定时器精度可能会有稍微误差,因为会涉及到任务调度、锁中断等,在对定时精度要求不高的场景,可以考虑使用软件定时器。Linux内核中的timer...
分类:其他好文   时间:2014-06-05 11:38:35    阅读次数:242
[数据结构] 二叉树的建立及其基本操作
如图: 代码:   #include #include #include #include using namespace std; char ch; typedef struct BinNode { char data; struct BinNode *lchild,*rchild; }BinNode,*BinTree; //二叉树链式...
分类:其他好文   时间:2014-06-05 09:15:24    阅读次数:203
用二叉链表实现二叉查找树(二)
/* 二叉查找树的链表实现: 以及三种遍历方式,删除节点; 查找节点; author:天下无双 Date:2014-5-28 Version:3.0 */ #include #include typedef int T;//树内节点的数据类型 using namespace std; class BiTree { private: struct BiNode{ T data;...
分类:其他好文   时间:2014-06-05 09:12:12    阅读次数:217
栈的应用举例-进行算术运算
这个例子是来自于严蔚敏的《数据结构》的栈那一节。 但是我进行了一些简单的修改,确保编译通过。 目的:利用栈 计算 “3*(7-2)”这样的字符串的算术运算的结果。 共有3个代码文件,如下: 1、mystack.h         #pragma once #define maxsize 30 typedef struct { char data[maxsize+1]; ...
分类:其他好文   时间:2014-06-05 07:35:18    阅读次数:242
POJ - 1111 Image Perimeters
题意:求'X'围成的周长 思路:按理说每增加一个就是周长加4,但是要减去重复的地方,这里我是用BFS做的,如果是BFS的模板思路的话是不行的,应该要先取出再标记 #include #include #include #include #include using namespace std; const int MAXN = 30; struct node { int x,y; ...
分类:其他好文   时间:2014-06-05 06:23:39    阅读次数:221
【HDOJ】1242 Rescue
BFS+优先级队列。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 #define MAXNUM 205 8 9 typedef struct node_st {10 int x, y...
分类:其他好文   时间:2014-06-03 06:50:09    阅读次数:259
bmp位图
BMP文件由位图文件头、位图信息头、调色板和图像数据四部分组成(1)位图文件头1 typedef struct tagBITMAPFILEHEADER2 {3 WORD bfType; //位图文件的类型,必须为BM(1-2字节)4 DWORD b...
分类:其他好文   时间:2014-05-31 12:54:56    阅读次数:254
求一棵普通树的两个结点的最低公共祖先
一棵普通树,树中的结点没有指向父节点的指针,求一棵普通树的两个结点的最低公共祖先。代码如下,我太懒没有加注释,大家自己看吧! 1 #include 2 #include 3 #include 4 using namespace std; 5 6 struct TreeNode /...
分类:其他好文   时间:2014-05-31 08:08:32    阅读次数:262
Trie树 POJ1056 IMMEDIATE DECODABILITY
题目:http://poj.org/problem?id=1056题意:判断是否有串是其他串的前缀#include#include#include#include#include#include#include#includeusing namespace std;struct Node{ i...
分类:其他好文   时间:2014-05-31 07:46:48    阅读次数:227
Linux下I/O复用 Select与Poll
Select#include #include #include int select (int n, fd_setreadfds, fd_setwritefds, fd_setexceptfds, struct timevaltimeout);FD_CLR(int fd, fd_set *set)...
分类:系统相关   时间:2014-05-31 02:32:17    阅读次数:508
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!