最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
入栈与出栈的所有排列可能性
时间:2022-07-02 11:04:01 编辑:袖梨 来源:一聚教程网
#include
#include
#include
#include
#include
/*定义全局变量*/
int pu=0,po=0,t=0;
char tp[130][12];
/*用栈排出入栈出栈的顺序*/
struct train{
int numb;
struct train *next;
};
struct push{
int a;
int b;
char data[24];
struct push *next;
};
struct push *creat(struct push *top)
{
top=(struct push *)malloc(sizeof(struct push));
top->next=NULL;
return top;
}
struct push *pup(struct push *top,int a,int b,int n)
{
struct push *p,*q;
q=top->next;
p=(struct push *)malloc(sizeof(struct push));
p->a=a;
p->b=b;
if(q)
strcpy(p->data,q->data);
if(q->a
p->data[a+b-1]='r';
p->data[a+b]='';
}
else
{
p->data[a+b-1]='c';
p->data[a+b]='';
}
p->next=top->next;
top->next=p;
return top;
}
struct push *pop(struct push *top)
{
top=top->next;
return top;
}
struct push *apaili(struct push *top,int numb) /*向后移动一个出命令*/
{
struct push *q;
q=top->next;
if(pu
pu++;
top=pup(top,pu,po,numb);
top=apaili(top,numb);
}
相关文章
- 本周可能影响比特币和加密货币价格的3个关键事件 07-01
- 王者荣耀甄姬逆浪荇歌什么时候上线 怎么获得 07-01
- 伊莫游戏引擎是哪个 伊莫游戏开发使用的引擎介绍 07-01
- 教学:币圈新人福利!保姆级免费撸空投教程:0成本薅羊毛全攻略 07-01
- Ripple vs. SEC:7月3日将成为XRP诉讼的下一个重要日期? 07-01
- 伊莫天气系统玩法详解 动态天气变化规律介绍 07-01