数据结构
文章平均质量分 67
爱笑的余尔吖
这个作者很懒,什么都没留下…
展开
-
prim算法
#include#include#include#includetypedef struct t{ char dian[30]; int bian[30][30]; int b,d;}ljt; void creat(ljt &G); void disp(ljt G); void prim(ljt G); void creat(ljt &G){ int i,j,k原创 2014-05-08 17:12:00 · 413 阅读 · 0 评论 -
十道海量数据处理面试题与十个方法大总结
文章出自于第一部分、十道海量数据处理面试题 1、海量日志数据,提取出某日访问百度次数最多的那个IP。 此题,在我之前的一篇文章算法里头有所提到,当时给出的方案是:IP的数目还是有限的,最多2^32个,所以可以考虑使用hash将ip直接存入内存,然后进行统计。 再详细介绍下此方案:首先是这一天,并且是访问百度的日志中的IP取出来,逐个写入到一个大文件中。注意到I转载 2014-09-25 17:06:34 · 435 阅读 · 0 评论 -
链表
#include#include#include#includetypedef struct stu{char xh[10];char xm[10];int cj[3];}STU,*STUP;typedef struct stunode{STU data;struct stunode *next;}Node,*LinkList原创 2014-05-08 10:39:00 · 408 阅读 · 0 评论 -
多项式求和求积(链表)
#include#include#include#includetypedef struct OrderList{ float coef; // 系数 int expn; // 指数 struct OrderList *next;} ElemType, *polynomial;int initorder原创 2014-05-08 10:58:43 · 971 阅读 · 0 评论 -
顺序表
#include#include#include#includetypedef struct student{ char xh[15]; char xm[10]; int cj[3];}STU,*STUP;typedef struct linklist{ STUP elem; int length; int listsize;}List;int in原创 2014-05-08 10:54:13 · 415 阅读 · 0 评论 -
求关键路径
#include#include#include#include#define Max 30typedef struct p1{ int data; int w; int a; struct p1*next;}bian;typedef struct{ int in; char elem; bian *first;}dian;typedef struct{ d原创 2014-05-08 17:15:39 · 498 阅读 · 0 评论 -
图的创建与显示
#include#include#include#include#define Max 30typedef struct{ char dian[Max]; int bian[Max][Max]; int d,b;}ljt;typedef struct{ int elem; char p[30];}data;typedef struct{ char dian[Ma原创 2014-05-08 17:13:07 · 476 阅读 · 0 评论 -
dijstla算法
#include#include#include#include#define Max 30typedef char str[30];typedef struct{ char dian[Max]; int bian[Max][Max]; int d,b;}ljt;void creat(ljt &G);//有向网有注释void disp(ljt G);void dij原创 2014-05-08 17:10:02 · 1539 阅读 · 0 评论 -
树的基本操作
#include#include#include#includetypedef char str[30];typedef struct t{ str data; struct t*child,*bro;}tree,*cstree;typedef struct q{ cstree *data; int f,r; int size;}queue;void init(q原创 2014-05-08 17:05:36 · 447 阅读 · 0 评论 -
链式队列
// bank.cpp : Defines the entry point for the console application.//#include "stdio.h"#include "conio.h"/****************************************** 定义数据结构************************************原创 2014-05-08 11:18:02 · 337 阅读 · 0 评论 -
二叉平衡树的基本操作
#include#include#include#includetypedef struct s{ char xh[20]; char xm[20]; char bj[15];}STD,*STP;typedef struct t{ STD data; struct t*lchild,*rchild;}node,*Tree;int search(Tree T,char原创 2014-05-08 17:14:51 · 426 阅读 · 0 评论 -
二叉树的基本操作
#include#include#include#includetypedef char str[30];typedef struct Node{ str data; struct Node *lchild,*rchild;}BiNode,*BiTree;typedef struct queue{ BiTree data; struct queue * next;原创 2014-05-08 17:02:50 · 458 阅读 · 0 评论 -
运动会安排(链队列)
#include #include #include #define status int#define ok 1#define error 0#define selemtype int/*链队列类型的定义*/typedef struct qlink{ selemtype data; struct qlink *next;}Node,*linkqueue;typedef原创 2014-05-08 11:20:21 · 1289 阅读 · 0 评论 -
顺序栈
#include#include#include#includetypedef struct { char *top; char *base; int stacksize;}charstack;typedef struct{ int *top; int *base; int stacksize;}intstack;void initchar(charstack &原创 2014-05-08 11:12:24 · 482 阅读 · 0 评论 -
floyd算法
#include#include#include#include#define Max 30typedef char str[30];typedef struct{ char dian[Max]; int bian[Max][Max]; int d,b;}ljt;void creat(ljt &G);//有向网有注释void disp(ljt G);void flo原创 2014-05-08 17:11:07 · 376 阅读 · 0 评论 -
循环队列
typedef int * Pint;typedef struct{ Pint *base; int front; int rear; int queuesize;}SqQueue;1.初始化void initqueue(SqQueue &Q,int max){ Q.base=new Pint[max]; Q.front=Q.rear=0; Q.qu原创 2014-05-08 17:01:36 · 503 阅读 · 0 评论 -
任意实数后缀表达式求值(链栈)
#include#include#include#includetypedef struct charstack{ char data; struct charstack *next;}Node1,*stack1;typedef struct intstack{ double data; struct intstack *next;}Node2,*stack2;voi原创 2014-05-08 11:07:31 · 914 阅读 · 0 评论 -
拓扑排序(图)
#include#include#include#includetypedef struct p{ int w; int data; struct p*next;}bian;typedef struct{ char data; int in; bian *first;}dian;typedef struct{ dian data[30]; int d,b;原创 2014-05-08 17:13:50 · 513 阅读 · 0 评论 -
轻松搞定面试中的二叉树题目
原文出处:http://blog.csdn.net/walkinginthewind/article/details/7518888树是一种比较重要的数据结构,尤其是二叉树。二叉树是一种特殊的树,在二叉树中每个节点最多有两个子节点,一般称为左子节点和右子节点(或左孩子和右孩子),并且二叉树的子树有左右之分,其次序不能任意颠倒。二叉树是递归定义的,因此,与二叉树有关的题目基本都可以用递归转载 2014-10-27 19:51:02 · 433 阅读 · 0 评论