# 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 operation of the algorithm restraint checking delimiters restraint each of these strings by using a stack and showing the fluctuation of the stack at each object. Do referable transcribe an algorithm.

a)

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

b)

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

## Expert Repartee

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

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

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

That achieve stay at purpose 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 own matching parenthesis, Stack contains (
‘{‘ : Push { onto Stack , Stack contains ( {
‘(‘ : Push ( onto Stack , Stack contains ( { (
[‘ : Push [ onto Stack , Stack contains ( { ( [
‘]’ : Pop [ from Stack as we own matching parenthesis, Stack contains ( { (
‘)’ : Pop ) from Stack as we own matching parenthesis, Stack contains ( {
‘}’ : Pop } from Stack as we own matching parenthesis, Stack contains (
‘)’ : Pop ) from Stack as we own matching parenthesis, Stack contains void

If the stack is void that resources string is balanced

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

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

That achieve stay at purpose of indication that resources string is referable balanced