Write a program that will create a linked list (using ListNode) of 20 Integers (random). Place the elements of the Linked List into a stack. Pop off the elements of the Stack and change values in the Linked List (use setValue()). The first element popped off the Stack should go into first place in the Linked List, the second value popped off should replace the second element in the linked list etc. The values in the Linked List should now be reversed.
Create a reverse directions class that uses a stack to store directions :
For example : If you travel
The computer will store the directions in a stack that is holding Direction Objects (a direction(String) and an int). End will not be stored in the stack.
printReverse() will give you the direction back home. For the above it will print :
Store the command in the Stack in the order that you went. Take in directions from the keyboard (2 pieces of info for each move). Translate direction back after you pop off Direction.
You should have member functions
public void enter();
public void printReverse();
Fill a stack with the numbers 1 - 52 (use Integer Objects for numbers). Write a method
public void moveToTop(Stack st, int n)
// precondition : n <= 52
It should take the nth Intger Object in your stack and moves it to the top leaving the rest of the stack unchanged. You may use a temporary stack to help you.
Fill a stack with 5 unique numbers. Pop and store each element until Stack is empty using recursion to loop. Then, push 2 copies of the elements that have been popped back onto the stack.