当前位置:网站首页>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
边栏推荐
- A detailed explanation of head pose estimation [collection of good articles]
- Summary of convolution layer and pooling layer
- 网络信息安全之零信任
- 在 VSCode 中调试 Jest 的测试用例,VSCode调试Jest测试用例报错basedir=$(dirname “$(echo “$0“ | sed -e ‘s,\\,/,g‘)“)解决
- Pagoda panel command line help tutorial (including resetting password)
- 5-minute NLP: text to text transfer transformer (T5) unified text to text task model
- 远程访问家里的树莓派(上)
- Im architecture: CPU architecture: SIMD vector processing (im-2.3)
- 异步时钟亚稳态 的解决方案——多bit信号
- How Im expressions work (5.3)
猜你喜欢

《通用数据保护条例》(GDPR)系列解读三:欧洲子公司如何向国内母公司回传数据?

PSCP basic usage

Introduction to metalama 4 Use fabric to manipulate items or namespaces

Resolution due to AMD not found_ ags_ x64. DLL, unable to continue code execution. Reinstallation of the program may solve this problem, Forza horizon 5

激活函数之阶跃函数

WIN10 启动后花屏

Metalama简介4.使用Fabric操作项目或命名空间

Tips for installing MySQL service in windows11: Install / Remove of the Service denied

Next.js 静态数据生成以及服务端渲染的方式

Idea code formatting plug-in save actions
随机推荐
How to solve the computer system card?
Windows11 安装MySQL服务 提示:Install/Remove of the Service Denied
VMware virtual machines export hard disk vmdk files using esxi
Tensorflow common functions
How Im expressions work (5.3)
PSCP basic usage
Why is there a wrapper class? By the way, how to convert basic data types, wrapper classes and string classes?
Idea code quality specification plug-in sonarlint
关于使用Go语言创建WebSocket服务浅谈
用户接口和IM表达式(IM 5.6)
编程辅助工具推荐:图片工具snipaste
《通用数据保护条例》(GDPR)系列解读三:欧洲子公司如何向国内母公司回传数据?
Summary of convolution layer and pooling layer
Fabric 1.0 source code analysis (33) implementation of peer channel command and subcommand
第四章 为IM 启用填充对象之为IM列存储启用ADO(IM 4.8)
IM 体系结构:CPU架构:SIMD向量处理(IM-2.3)
Use kettle to copy records to and get records from results
数组---
C set Logo Icon and shortcut icon
Fabric 1.0源代码分析(33) Peer #peer channel命令及子命令实现