Question: Given the Linked List Implementation of a Stack ( reference Node * top, is available for use ) , write pseudocode that will determine which
Given the Linked List Implementation of a Stack reference Node top, is available
for use write pseudocode that will determine which value in the stack is the smallest and remove and
return that value while otherwise leaving the remainder of the stack in its original order.
Thus, if the stack contains values:
bottom top
then a call to findAndRemoveSmalleststack would return the value and leave stack as follows:
bottom top
In your solution, you may only declare extra Stack or primitive variables eg ints, doubles not arrays or
linked lists if needed.
You can assume that any Stack you use will never become full and that the provided stack will not contain duplicate values.
Rather than throwing an exception, if the provided stack is empty findAndRemoveSmallest will print an error message..
Write your pseudocode for findAndRemoveSmallest
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
