# Submit one properly named - Expert Work

Submit one properly named .rtf document inside your one .jar file. lastname.firstname.mod4.

1. What is the characteristic behavior of a stack?

2. What is the characteristic behavior of a queue

3. What are the advantages of the java.util.Stack implementation of a stack?

4. What are the dis-advantages of the java.util.Stack implementation of a stack?

5. Hand trace a stack X through the following operations, for your answer show the values remaining in the stack (be certain to indicate the ‘top’ of the stack:

a. X.push(new Integer(4));

b. X.push(new Integer(3));

c. Integer Y = X.pop();

d. X.push(new Integer(7));

e. X.push(new Integer(2));

f. X.push(new Integer(5));

g. X.push(new Integer(9));

h. Integer Y = X.pop();

i. X.push(new Integer(3));

j. X.push(new Integer(9));

6. Given the resulting stack X from the previous exercise, what would be the result of each of the following? In your answer give the value of “Y” or “Y and Z”. Note: Steps b. and c. should view the stack as coming out of the previous step.

a. Y = X.peek();

b. Y = X.pop(); Z = X.peek();

c. Y = X.pop(); Z = X.peek();

7. Complete exercise 21.4 (SelectionSort and SelectionSortDemo).

8. Complete exercise 21.7 (IET and IETDemo (IsEqualTo)) (see below)

9. Complete exercise 21.8 (Pair and PairDemo). (see below)

10. Complete the LinkedStack.java in the supplied jar file.

11. Also complete the ArrayStack.java.

12. Convert the PostFixEvaluator to use the ArrayStack. Create a lastnameArrayStack package for this.

13. Convert the PostFixEvaluator to use the Java.Util.Stack. Create a lastnameStack package for this.

Submit your .jar file (containing you .rtf document) to Blackboard.

1. What is the characteristic behavior of a stack?

2. What is the characteristic behavior of a queue

3. What are the advantages of the java.util.Stack implementation of a stack?

4. What are the dis-advantages of the java.util.Stack implementation of a stack?

5. Hand trace a stack X through the following operations, for your answer show the values remaining in the stack (be certain to indicate the ‘top’ of the stack:

a. X.push(new Integer(4));

b. X.push(new Integer(3));

c. Integer Y = X.pop();

d. X.push(new Integer(7));

e. X.push(new Integer(2));

f. X.push(new Integer(5));

g. X.push(new Integer(9));

h. Integer Y = X.pop();

i. X.push(new Integer(3));

j. X.push(new Integer(9));

6. Given the resulting stack X from the previous exercise, what would be the result of each of the following? In your answer give the value of “Y” or “Y and Z”. Note: Steps b. and c. should view the stack as coming out of the previous step.

a. Y = X.peek();

b. Y = X.pop(); Z = X.peek();

c. Y = X.pop(); Z = X.peek();

7. Complete exercise 21.4 (SelectionSort and SelectionSortDemo).

8. Complete exercise 21.7 (IET and IETDemo (IsEqualTo)) (see below)

9. Complete exercise 21.8 (Pair and PairDemo). (see below)

10. Complete the LinkedStack.java in the supplied jar file.

11. Also complete the ArrayStack.java.

12. Convert the PostFixEvaluator to use the ArrayStack. Create a lastnameArrayStack package for this.

13. Convert the PostFixEvaluator to use the Java.Util.Stack. Create a lastnameStack package for this.

Submit your .jar file (containing you .rtf document) to Blackboard.

You'll get a 73.5KB .ZIP file.