Question: #include #include #include stackAsArray.h # IMPORTANT NOTICE # This file needs stackAsArray.h and stackADT.h files to run. # You can find those files in

#include
#include
#include "stackAsArray.h"
# IMPORTANT NOTICE
# This file needs stackAsArray.h and stackADT.h files to run.
# You can find those files in "resources/LABS/lab04" folder.
using namespace std;
#define SIZE 10
bool testSymmetry(stackType s)
{
//* Write your solution here for Question 2.
}
int main()
{
stackType myStack(SIZE);
myStack.push(1);
myStack.push(2);
myStack.push(3);
myStack.push(3);
myStack.push(2);
myStack.push(1);
bool c = testSymmetry(myStack);
// The stack given above is symmetric, so you should see "Symmetric!" at the screen.
// Try with different stacks and check your results.
if (c)
cout "Symmetric !";
else
cout "NOT Symmetric !";
return 0;
}Q2) Write a non-member function that tests whether a given stack s (of type
stackType int >) is symmetric with respect to its middle point. The function should
return true if the stack is symmetric; otherwise it should return false. The original
stack should be preserved after the operation. You should use the basic stack operations
(isEmptyStack, top, pop, push) in your solution. Feel free the use auxiliary stack(s)
whenever you need to.
(As an example, the function should return true for the stacks a and [12
321; but it should return fal se for [a b c b and [122341. Empty stacks should be
considered as symmetric).
bool testSymmetry(
 #include #include #include "stackAsArray.h" # IMPORTANT NOTICE # This file needs

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!