Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. Please revise the parenthesis matching algorithm pseudo code that we discussed in class so that it a. will work with multiple types of parenthesis

image text in transcribed
4. Please revise the parenthesis matching algorithm pseudo code that we discussed in class so that it a. will work with multiple types of parenthesis (eg parentheses, square brackets, curly brackets) b. indicates the location of the first offense if the string does not have the matching parenthesis. Your algorithm must be general enough that works with any string you may receive from the user. Some sample input you may expect, and the corresponding results: a(b(cd)) -- OK a((bed) -- location 1 doesn't have a matching ) a([bc)) -- location 2 doesn't have a matching a([bc]) -- OK a([bc])) -- location 8 doesn't have a matching! Note: You are writing ONE algorithm that works for both a and babove. 5. Please write an algorithm in pseudo code so that it moves all the contents in a stack into a queue. Your final queue must have the items in the same order as they were in the stack. For example, if from the bottom to the top of the stack is "A, B, C". Your queue should have it from the front to rear as "A, B and C". As usual, your algorithm must be general enough so that it works for any size of the stack and queues. Original Stack Final Queue B B A

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions

Question

Describe the role of the stakeholder, and list several examples.

Answered: 1 week ago

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago