- 博客(7)
- 收藏
- 关注
原创 中缀表达式转成后缀表达式 后缀表达式求值
#include #include #include using namespace std;const int MAXSIZE = 100;typedef char Datatype;typedef struct{ int top; Datatype data[MAXSIZE]; }Seqstack, *pSeqstack;pSeqstack init(void){ pSe
2015-05-13 18:19:46
387
原创 表达式编辑
使用栈模拟表达式编辑。#include #include #define MAXSIZE 100typedef char Datatype;typedef struct{ int top; Datatype data[MAXSIZE];}seqstack,*pseqstack;pseqstack init_stack(void){ pseqstack s;
2015-05-12 11:18:22
291
原创 括号检测
利用栈实现,注意非法情况的检测处理。#include #include #define MAXSIZE 100typedef char Datatype;typedef struct{ int top; Datatype data[MAXSIZE];}seqstack,*pseqstack;pseqstack init_stack(void){ pseqs
2015-05-12 10:21:58
712
原创 约瑟夫问题
用链表实现,也可用顺序表实现。#include #include #define MAX_SIZE 1024typedef struct node{ int data[MAX_SIZE]; int length;}SeqList,*PSeqList;/************************************************************
2015-05-12 09:31:24
263
原创 一元多项式相加
使用链表实现。#include #include typedef struct node{ float p; unsigned int e; struct node *next;}polynomial,*p_polynomial;p_polynomial poly_add(p_polynomial a, p_polynomial b){ p_polynomial
2015-05-12 09:25:49
484
原创 数制转换
#include #include #define MAXSIZE 100typedef struct{ int data[MAXSIZE]; int top;}seqstack,*pseqstack;pseqstack init_stack(void){ pseqstack s; s = (pseqstack)malloc(sizeof(seqstack)); if
2015-05-12 09:20:59
291
原创 迷宫问题
用栈实现迷宫问题的求解,主要算法如下:1、初始化;2、以栈是否为空表示是否还有可能的路径,并作为循环终止条件;3、在循环内分情况处理: (1)若探测到下一个位置可行进,则将当前位置及将要移动的方向信息压栈,再移动到新位置;(要注意等上一个位置的全部信息都确定了后再压栈,不能忽略方向) (2)若下一个位置不可行进,再分两种情况:[1]若还有其它可能行进的
2015-05-11 15:35:38
244
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人