Question: iven an array, push the values of the array until a -1 value is found or the stack is full - the -1 does not

iven an array, push the values of the array until a -1 value is found or the stack is full - the -1 does not get pushed to the stack. After that, pop the values in the stack until an even value is found or the stack is empty - popping the even value. Then iterate until the stack is full or the inputArray is read completely.

Print the contents of the stack, from the top to bottom, using 0 for empty positions and a space to separate values. Example: 0 10 9 8 7 6

a) If inputArray={10, -1, 3, 2, 3, -1, 4, 5, 7, 8, 9, 10, 11} and maxSize=6 :

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!