Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Needing some help here, can't use the stack standard library so needing this done using the array implementation of stack. Thank you, C++. Implement a

Needing some help here, can't use the stack standard library so needing this done using the array implementation of stack. Thank you, C++.

image text in transcribed

Implement a Stack class using the List Class you developed earlier. Test your Stack class by determining if the following strings have matching open and closing and/or [] and/or { } and/or . The following is one set of data to test your code: Test Set 1: O [100 [{0}] >> [D) {O[0]} Print out the input string and if the string is matched or mismatched. You will ignore characters that are not in the above set of matching characters. You have three input files for testing: The data above is the first input file, Stack3.data and Lisp ClassData.txt. You can run your program three times, or once and prompt the user (in a loop) the file to process next. Cool huh. Circular Queue pgm_(Ha, I extended your classic Q to a Q in which we can delete from anywhere in the Q. You will need to add a method to move in the Q then to delete this element, le delete from anywhere in the Q. You will enqueue inorder to initially fill the Q.) In an ancient land, the beautiful princess named Star had many suitors. She decided on the following procedure to determine which suitor she would marry. First, all of the suitor's would be lined up one after the other and assigned a letter symbol. The first suitor would be some ascii character, the second would be the next ascii character, and so on up to the last suitor up to the last suitor est (you can pick the symbols.). Starting at the first suitor she would then count four suitors down the line (because of the four letters in Star's name and the fourth suitor would be eliminated from winning her hand and removed from the line(Q). Star would then continue from that position in the list, counting four more suitors, and eliminate every fourth suitor. When she reached the end of the line she would continue counting circular at the beginning four suitors more (this is circular and you do not necessarily start counting from one just because you are at the front of the line. (See example below) For example, if there were six suitors then the elimination process would proceed as follows: ABCDEF initial list of suitors, start counting from 1 ABCEF suitor D eliminated, continue counting from E ACEF suitor B eliminated, continue counting from C CEF suitor A eliminated, continue counting from C suitor C eliminated, continue counting from E suitor F eliminated, E is the lucky winner Note about your List class. You developed you List class (I hope) using ET (Element Type) for the data type stored in the array (List). Now the above you will need to change the 'typedef of ET from int to char. If you have a good class development, then this should be one line change, if not, you will have several ints to change. Be sure not to change the ints that deal with position, size etc. just the data type stored in the list. Star had 65 suitors. khar="#:/ could be a start character? for (i=1;i. The following is one set of data to test your code: Test Set 1: O [100 [{0}] >> [D) {O[0]} Print out the input string and if the string is matched or mismatched. You will ignore characters that are not in the above set of matching characters. You have three input files for testing: The data above is the first input file, Stack3.data and Lisp ClassData.txt. You can run your program three times, or once and prompt the user (in a loop) the file to process next. Cool huh. Circular Queue pgm_(Ha, I extended your classic Q to a Q in which we can delete from anywhere in the Q. You will need to add a method to move in the Q then to delete this element, le delete from anywhere in the Q. You will enqueue inorder to initially fill the Q.) In an ancient land, the beautiful princess named Star had many suitors. She decided on the following procedure to determine which suitor she would marry. First, all of the suitor's would be lined up one after the other and assigned a letter symbol. The first suitor would be some ascii character, the second would be the next ascii character, and so on up to the last suitor up to the last suitor est (you can pick the symbols.). Starting at the first suitor she would then count four suitors down the line (because of the four letters in Star's name and the fourth suitor would be eliminated from winning her hand and removed from the line(Q). Star would then continue from that position in the list, counting four more suitors, and eliminate every fourth suitor. When she reached the end of the line she would continue counting circular at the beginning four suitors more (this is circular and you do not necessarily start counting from one just because you are at the front of the line. (See example below) For example, if there were six suitors then the elimination process would proceed as follows: ABCDEF initial list of suitors, start counting from 1 ABCEF suitor D eliminated, continue counting from E ACEF suitor B eliminated, continue counting from C CEF suitor A eliminated, continue counting from C suitor C eliminated, continue counting from E suitor F eliminated, E is the lucky winner Note about your List class. You developed you List class (I hope) using ET (Element Type) for the data type stored in the array (List). Now the above you will need to change the 'typedef of ET from int to char. If you have a good class development, then this should be one line change, if not, you will have several ints to change. Be sure not to change the ints that deal with position, size etc. just the data type stored in the list. Star had 65 suitors. khar="#:/ could be a start character? for (i=1;i

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

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions