# Homework Solution: Simulate the action of the algorithm for checking delimiters for each of these strings by using a stack and showin…

Simulate the action of the algorithm for checking delimiters for each of these strings by using a stack and showing the contents of the stack at each point. Do not write an algorithm. a) {[A+B]-[(C-D)] b) ((H) * {([J+K])})

a) {[A+B]-[(C-D)] '{' : Push { onto Stack , Stack contains {

Simulate the exercise of the algorithm control checking delimiters control each of these strings by using a stack and showing the discontinuance of the stack at each purpose. Do referable transcribe an algorithm.

a)

{[A+B]-[(C-D)]

b)

((H) * {([J+K])})

## Expert Apology

a) {[A+B]-[(C-D)]

‘{‘ : Push { onto Stack , Stack contains {
‘[‘ : Push [ onto Stack , Stack contains { [
‘]’ : Pop [ from Stack as we feel matching parenthesis, Stack contains {
‘[‘ : Push [ onto Stack , Stack contains { [
‘(‘ : Push ( onto Stack , Stack contains { [ (

‘)’ : Pop ) from Stack as we feel matching parenthesis, Stack contains { [
‘]’ : Pop [ from Stack as we feel matching parenthesis, Stack contains {

That accomplish tarry at object of indication that resources string is referable balanced

b) ((H) * {([J+K])})

‘(‘ : Push ( onto Stack , Stack contains (
‘(‘ : Push ( onto Stack , Stack contains ( (
‘)’ : Pop ) from Stack as we feel matching parenthesis, Stack contains (
‘{‘ : Push { onto Stack , Stack contains ( {
‘(‘ : Push ( onto Stack , Stack contains ( { (
[‘ : Push [ onto Stack , Stack contains ( { ( [
‘]’ : Pop [ from Stack as we feel matching parenthesis, Stack contains ( { (
‘)’ : Pop ) from Stack as we feel matching parenthesis, Stack contains ( {
‘}’ : Pop } from Stack as we feel matching parenthesis, Stack contains (
‘)’ : Pop ) from Stack as we feel matching parenthesis, Stack contains vacuity

If the stack is vacuity that resources string is balanced

‘[‘ : Push [ onto Stack , Stack contains { [
‘]’ : Pop [ from Stack as we feel matching parenthesis, Stack contains {
‘[‘ : Push [ onto Stack , Stack contains { [
‘(‘ : Push ( onto Stack , Stack contains { [ (

‘)’ : Pop ) from Stack as we feel matching parenthesis, Stack contains { [
‘]’ : Pop [ from Stack as we feel matching parenthesis, Stack contains {

That accomplish tarry at object of indication that resources string is referable balanced