Question: All questions are in Java: 1. explain the rationale for returning a boolean value from the addEntry bag operation 2. explain why the set ADT
All questions are in Java:
1. explain the rationale for returning a boolean value from the addEntry bag operation
2. explain why the set ADT does not need a getFrequencyOf operation
3. Draw the resultant stack after the following operations. Label the top entry of your stack. push(X), push(Q), push(Y), peek(), pop(), push(T), peek()
4. Convert the following infix expression to a postfix expression w * (x + y) / z
6. In an array based implementation of a stack ADT, explain why is it a bad idea to use first location of the array to reference the top of a stack
7. draw the contents of a queue after the following statements execute. Clearly label the front and back of the queue.
QueueInterface
bankLine.enqueue("John");
bankLine.enqueue("Mathew");
String next = bankLine. dequeue();
next = bankLine.dequeue();
bankLine.enqueue("Drew");
bankLine.enqueue("Heather");
next=bankLine.dequeue();
bankLine.enqueue("David");
next= bankLine.dequeue();
8. Draw the contents of a deque after the following statements execute. Clearly label the front and back of the deque.
DequeInterface
waitingLine.addToBack("Adam");
waitingLine.addToFront("Rudy");
waitingLine.addToBack("Larry");
waitingLine.addToBack("Sam");
waitingLine.addToFront("Jack");
String name = waitingLine.getFront();
name=getFront();
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
