数据结构
Ares233
这个作者很懒,什么都没留下…
展开
-
Pointer详解
#include <stdlib.h>typedef struct LNode{ int number; int password; struct LNode * next; }LNode, *Linklist;void swap1(int a, int b){ int temp; temp = a; a = b;原创 2016-10-07 10:39:13 · 713 阅读 · 0 评论 -
模式匹配
#include<cstdio>#include<iostream>using namespace std;int i,j,pos,next[20];void get_next(string T){ i=1,j=0; next[1]=0; while(i<T.length()) { if(j==0||T[i-1]==T[j-1])原创 2016-10-07 10:42:07 · 188 阅读 · 0 评论 -
约瑟夫环
#include<bits/stdc++.h>#define maxn 50using namespace std; bool in[maxn];//int a[maxn];queue<int> q;int c[maxn],t[maxn];int main(){ memset(in,0,sizeof(in)); int i,j,k,m,n,code,*p; p原创 2016-10-07 10:45:43 · 229 阅读 · 0 评论 -
约瑟夫环
#include<cstdio>#include<cstdlib>//#include<bits/stdc++.h>using namespace std;typedef struct Lnode{ int id; int code; struct Lnode *next;}Lnode,*Linklist;Linklist Createlist(int n)//原创 2016-10-07 10:46:53 · 263 阅读 · 0 评论 -
一元稀疏多项式相加
#include<cstdio>#include<cstdlib>using namespace std;typedef struct{ int ceof; int expn;}Poly;typedef struct Polynode{ Poly data; struct Polynode *next;}Polynode,*Polylink;void原创 2016-10-07 10:49:15 · 1154 阅读 · 0 评论 -
线性表
#include<cstdio>#include<cstdlib>#define LIST_INIT_SIZE 100#define LISTINCREMENT 10using namespace std;typedef int ElemType;ElemType *pa,*pb,*pc,*pa_last,*pb_last,*p0;typedef struct { ElemT原创 2016-10-07 10:51:11 · 265 阅读 · 0 评论 -
算数表达式求值
#include<bits/stdc++.h>#define maxn 30using namespace std;unsigned char Prior[8][8] ={ //运算符优先级表 // '+' '-' '*' '/' '(' ')' '#' '^' {'>','>','<','<','<','>','>','<'}, {'>','>'原创 2016-10-07 11:07:29 · 757 阅读 · 0 评论 -
括号匹配
#include<cstdio>using namespace std;int main(){ char str[25]; fgets(str,25,stdin); char *p; int top=0,flag=0; char stack[25]; for(p=str;*p&&flag==0;p++) { switch(原创 2016-10-07 11:09:38 · 300 阅读 · 0 评论