当前位置:网站首页>bracket matching
bracket matching
2022-08-04 20:55:00 【[email protected]】
[Example] The parentheses in arithmetic expressions in C language are only parentheses.Write an algorithm to determine whether the parentheses in an expression are paired correctly. The expression has been stored in the character array exp[], and the number of characters in the expression is n.
int match(char exp[],int n){char stack[maxSize]; //maxSize is a defined constantint top=-1;int i;for(i=0;i<n;++i){if(exp[i]==')')if(top==-1)return 0;else--top;else if(exp[i]=='(')stack[++top]='(';}if(top==-1)return 1;elsereturn 0;}版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/216/202208042042152123.html
边栏推荐
猜你喜欢

宝塔实测-搭建中小型民宿酒店管理源码

如何进行AI业务诊断,快速识别降本提效增长点?

CAS :80750-24-9(脱硫生物素 NHS 酯)

零知识证明笔记——私密交易,pederson,区间证明,所有权证明

Oreo domain name authorization verification system v1.0.6 public open source version website source code

【2022牛客多校5 A题 Don‘t Starve】DP

Matlab画图2

Retrofit的使用及原理详解

五分钟入门文本处理三剑客grep awk sed

【CAS:2306109-91-9 |胺-PEG4-脱硫生物素】价格
随机推荐
Apache服务器的配置[通俗易懂]
Desthiobiotin衍生物Desthiobiotin-PEG4-Amine/Alkyne/Azide/DBCO
常用正则表达式[通俗易懂]
该如何训练好深度学习模型?
Using Baidu EasyDL to realize forest fire early warning and identification
idea2021版本添加上一步和下一步操作到工具栏
win10 uwp 使用 WinDbg 调试
帝国CMS仿核弹头H5小游戏模板/92game帝国CMS内核仿游戏网整站源码
IPV6地址
Comic | Two weeks after the boss laid me off, he hired me back and doubled my salary!
win10 uwp 使用 ScaleTransform 放大某个元素
Desthiobiotin-PEG4-Azide_脱硫生物素-叠氮化物 100mg
SAP ABAP OData 服务如何支持 $select 有选择性地仅读取部分模型字段值试读版
DICOM医学影像协议
五分钟入门文本处理三剑客grep awk sed
C语言小笔记+题
搭建MyCat2一主一从的MySQL读写分离
How to train a deep learning model?
密码学系列之:PEM和PKCS7,PKCS8,PKCS12
Big capital has begun to flee the crypto space?