本段程序实现串的存储结构是采用堆的动态分配存储表示,并实现了几乎所有常用的串的配套函数
其中逻辑性比较强的就是串的模式匹配算法,在下面的程序中,分别用BF算法和KMP算法对其进行了
实现。
#include
using namespace std;
struct HString
{
HString()
{
ch = 0;
length = 0;
}
char * ch;//...
分类:
编程语言 时间:
2014-05-14 01:12:35
阅读次数:
378
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
void FD_CLR(int fd, fd_set *set);
int FD_ISSET(int fd, fd_set *set);
void FD_SET(int fd, fd...
分类:
其他好文 时间:
2014-05-14 00:03:02
阅读次数:
440
手动模拟。。
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define N 10100
#define inf 1000000010
mapx,y;
struct X{
int x,y;
bool operator<(const X&a)const{...
分类:
其他好文 时间:
2014-05-13 07:29:10
阅读次数:
294
__attribute__((packed))的作用
在结构体变量的声明中,经常可以看到__attribute__((packed))修饰符。这是做什么用的呢?请看一下程序:
#define u8 unsigned char
#define u16 unsigned short
#define u32 unsigned int
int main()
{
struct {
...
分类:
其他好文 时间:
2014-05-13 06:19:18
阅读次数:
416
如果一个多层次的数据结构达到两级或者两级以上,举例如下:
struct A{
int array_member[100];
//其他数据成员
};
struct B{
struct A *a_ptr;
//其他数据成员
}
那么通过B类型的指针b_ptr访问A类型的array_member的某一个元素array_member[0]则需要使用b_...
分类:
编程语言 时间:
2014-05-13 06:00:59
阅读次数:
270
本段程序主要利用数据结构栈的先进后出特点,实现回溯求解迷宫路径问题。
#include
#include
using namespace std;
//坐标类
struct Point
{
int x;
int y;
};
//地图类
template
struct Map
{
int (*p)[A];
int row;//行数
int col;//列数
};
//start起始点, ...
分类:
其他好文 时间:
2014-05-13 05:25:02
阅读次数:
478
#include #include #include #include #include
#include #include #include #include #include using namespace std;struct
MyStruct{ string stru; int ...
分类:
其他好文 时间:
2014-05-12 21:51:09
阅读次数:
572
邻接矩阵的图示:
构建一个这样的无向邻接矩阵。
参考网站: http://www.geeksforgeeks.org/graph-and-its-representations/
这里写了个类,增加删除图的操作。
#pragma once
#include
#include
class AdjListGraph
{
struct Node
{
int dest;
...
分类:
其他好文 时间:
2014-05-11 22:44:20
阅读次数:
378
这里用邻接表实现图的深度优先遍历,采用递归实现。
#include
using namespace std;
#define VERTEXNUM 5//结点数
struct edgenode
{
int to;
int weight; // 边的权值
edgenode *next;
};
struct vnode
{
int from...
分类:
其他好文 时间:
2014-05-11 20:46:16
阅读次数:
519
产生原因:多文件包含时,全局变量未用extern解决方法:直接在全局变量前加上extern即可,若要在在其他文件中使用,该变量声明下就ok了~~另外引出一个话题,你是不是也发现了这么一个现象??比如A.hA.cpp#include
"A.h"#include "B.h"HWND ui_hwnd, h...
分类:
其他好文 时间:
2014-05-11 17:25:39
阅读次数:
526