Question: Abstract Data Types (a) Explain briefly what is meant by the term abstract data type (ADT). Give two reasons why use of ADTs is good
(b) Write out a signature, or interface, that defines the operations of a stack ADT. (c) Consider a string of characters of the form ... (.( ... ).) ... where ... indicates an arbitrary sequence of characters (except for parentheses), (.( indicates an arbitrary number (one or more) of opening parentheses, and similarly ).) indicates an arbitrary number of closing parentheses. Using only the stack abstraction operations defined above, write pseudocode for an algorithm that determines, using a stack, whether or not the number of closing parentheses is the same as the number of opening parentheses. You may assume the existence of a function read(str,ch) that reads the next character of string str into ch. You may also assume that you can invoke a function reportFail, that will cause termination with failure, and similarly, reportSuccess causes termination with a success indication. Further, you may also assume that you can call a function newStack(S) to create a new empty stack S, and eos(str) that returns false when you reach the end of the string.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
