Stack 1. Suppose you have an array arr includs the following integer element (15, 1, 6, 12, -3, 4, 8, 21, 2, 30, -1, 9). Create two stacks inside a class SplitStack. One posStack to store the positive...


Stack<br>1. Suppose you have an array arr includs the following integer element (15, 1, 6, 12, -3, 4, 8, 21, 2,<br>30, -1, 9). Create two stacks inside a class SplitStack. One posStack to store the positive elements<br>from arr and the second negStack to store the negative elements from arr.<br>After that, restore the positive elements from posStack to negStack stack so that all the negatives<br>appear on the bottom of the negStack and all the positives appear on the top.<br>It does not matter what order the numbers appear in as long as all the negatives appear lower in<br>the Stack than all the non-negatives.<br>

Extracted text: Stack 1. Suppose you have an array arr includs the following integer element (15, 1, 6, 12, -3, 4, 8, 21, 2, 30, -1, 9). Create two stacks inside a class SplitStack. One posStack to store the positive elements from arr and the second negStack to store the negative elements from arr. After that, restore the positive elements from posStack to negStack stack so that all the negatives appear on the bottom of the negStack and all the positives appear on the top. It does not matter what order the numbers appear in as long as all the negatives appear lower in the Stack than all the non-negatives.

Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here