文件名称:Matching-brackets
介绍说明--下载内容均来自于网络,请自行研究使用
数据结构
1、算法思路:
假设表达式中包含两种括号:圆括号和方括号,其嵌套顺序随意,即([]())或[([])]等为正确的格式,[(])或([())或(()]均为不正确的格式。检验括号是否匹配可以用堆栈来实现当遇到 ( 或 [ 时进栈,遇到 ) 或 ] 时出栈进行匹配检验,如果出现不匹配的情况立即结束,否则继续取下一个字符。如果没有遇到不匹配的情况,最后判断栈是否为空,栈为空,括号匹配,否则不匹配。
-Data Structure 1, Algorithm idea: the assumption that the expression contains two types of brackets: parentheses and brackets, the nested sequence of random, that is, or ([]()) [([])] such as the correct format, [( ]) or ([()) or (()] are not the correct format. test match brackets can be used to achieve when the stack (or [into the stack when encountered) or] when a stack test match , if the situation does not match an immediate end to, or continue to remove a character. If you do not encounter the situation does not match, the last to judge whether the stack is empty, the stack is empty, parentheses matching, otherwise do not match.
1、算法思路:
假设表达式中包含两种括号:圆括号和方括号,其嵌套顺序随意,即([]())或[([])]等为正确的格式,[(])或([())或(()]均为不正确的格式。检验括号是否匹配可以用堆栈来实现当遇到 ( 或 [ 时进栈,遇到 ) 或 ] 时出栈进行匹配检验,如果出现不匹配的情况立即结束,否则继续取下一个字符。如果没有遇到不匹配的情况,最后判断栈是否为空,栈为空,括号匹配,否则不匹配。
-Data Structure 1, Algorithm idea: the assumption that the expression contains two types of brackets: parentheses and brackets, the nested sequence of random, that is, or ([]()) [([])] such as the correct format, [( ]) or ([()) or (()] are not the correct format. test match brackets can be used to achieve when the stack (or [into the stack when encountered) or] when a stack test match , if the situation does not match an immediate end to, or continue to remove a character. If you do not encounter the situation does not match, the last to judge whether the stack is empty, the stack is empty, parentheses matching, otherwise do not match.
相关搜索: matching
括号匹配
algorithm
parentheses
and
brackets
sicily
Brackets
Matching
brackets
parantheses
algorithm
sicily
Brackets
Matchi
括号匹配
algorithm
parentheses
and
brackets
sicily
Brackets
Matching
brackets
parantheses
algorithm
sicily
Brackets
Matchi
(系统自动生成,下载前可以参看下载内容)
下载文件列表
实验2 括号匹配.doc