当前位置:网站首页>Stacks and queues a
Stacks and queues a
2022-04-23 12:15:00 【Yuerya.】
One . Stack
1. Definition (top A subscript pointing to the last element )
#define Max 100
Typedef struct stack{
SElemType data[Max] // or *data;
int top;
int stackSize;
}sqStack;
2. initialization
int InitSqStack(sqStack *LS,int max){
LS->data=(SElemType*)malloc(max*(SElemType));
if(LS->data==NULL) { printf(" Application failed \n"); exit(0); }
LS->top=-1;
LS->stackSize=max;
return 1;
}
3. The judgment is empty
int EmptyStack(sqStack S){
if(S.top==-1) return 1;
else return 0;
}
4. Get the top of the stack
int GetTopSqStack(sqStack S,SElemType *e){
if(S.top==-1) return 0;
*e=S.data[S.top];
return 1;
}
5. Find the length
int lengthsqStack(sqStack S){
if(S.top==-1) return 0;
return S.top+1;
}
6. Into the stack
int PushsqStack(sqStack *S,SElemType e){
if(S->top+1==S->stackSize) // If the stack is full
版权声明
本文为[Yuerya.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231212025744.html
边栏推荐
- 第四章 为IM 启用填充对象之在NO INMEMORY表上指定INMEMORY列属性:示例(IM-4.4 第四部分)
- 第四章 为物化视图启用和禁用IM列存储(IM 4.6)
- The fourth chapter is the enable and disable columns of IM enabled fill objects (Part III of im-4.3)
- 数据库如何填充IM表达式(IM 5.4)
- 抓包整理————tcp 协议[八]
- VMware虚拟机使用esxi 导出硬盘vmdk文件
- The maximum number of remote desktop servers has been exceeded
- How imeu is associated with imcu (IM 5.5)
- Tips for installing MySQL service in windows11: Install / Remove of the Service denied
- 智能多线弹性云增加独立的IP地址,如何实现多线功能?
猜你喜欢
Win10 splash screen after startup
Fastjson 2 is coming, the performance continues to improve, and it can fight for another ten years
Introduction to metalama 4 Use fabric to manipulate items or namespaces
一个平面设计师的异想世界|ONES 人物
远程访问家里的树莓派(上)
编程辅助工具推荐:图片工具snipaste
传统企业如何应对数字化转型?这些书给你答案
Idea setting copyright information
魔域来了H5游戏详细图文架设教程
Pagoda panel command line help tutorial (including resetting password)
随机推荐
Introduction to metalama 4 Use fabric to manipulate items or namespaces
AI 视频云 VS 窄带高清,谁是视频时代的宠儿
Lesson 26 static member functions of classes
VMware虚拟机使用esxi 导出硬盘vmdk文件
SPSS之单因素方差分析
论文解读(CGC)《CGC: Contrastive Graph Clustering for Community Detection and Tracking》
Pagoda panel command line help tutorial (including resetting password)
Siri gave the most embarrassing social death moment of the year
How to expand the capacity of the server in the 100 million level traffic architecture? Well written!
WIN10 启动后花屏
31岁才转行程序员,目前34了,我来说说我的经历和一些感受吧...
Tensorflow common functions
Fabric 1.0源代码分析(33) Peer #peer channel命令及子命令实现
IFLYTEK's revenue in 2021 was 18.3 billion yuan: a year-on-year increase of 41% and a net profit of 1.556 billion yuan
Recommended programming AIDS: picture tool snipaste
Xinwangda announced that the price of battery products had been increased, and the investment of "weixiaoli" exceeded 1 billion
In idea Solution to the problem of garbled code in Chinese display of properties file
Chapter 5 optimizing queries using in memory expressions (IM 5.1)
Tan Xiang, CEO of Kechuang · Pera software: the essence of zero trust is digital security. To B should also deeply study the user's mind
为什么要有包装类,顺便说一说基本数据类型、包装类、String类该如何转换?