Question: 1)Suppose you write a program that models a card deck. Cards are taken from the top of the deck and given out to players. As
1)Suppose you write a program that models a card deck. Cards are taken from the top of the deck and given out to players. As cards are returned to the deck, they are placed on the bottom of the deck. Would you store the cards in a stack or a queue?
2)Suppose the strings "A" . . . "Z" are pushed onto a stack. Then they are popped off the stack and pushed onto a second stack. Finally, they are all popped off the second stack and printed. In which order are the strings printed?
3)What is the difference between a set and a map?
4)How can you compute the union and intersection of two sets, using some of the methods that the java.util.Set interface provides, but without using an iterator?
5)Can a map have two keys with the same value? Two values with the same key?
6)A map can be implemented as a set of (key, value) pairs. Explain
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
