Say u have gumballs (all different colors), storing them into a stack. I was wondering what would be the best way to "eat" a gumball, move all blocking gumballs out of the way—in order; then remove the color gumball that is requested, then move the blocking gumballs back in their original order. (Hint: use another stack to hold these blocking gumballs.) in order to keep a counter, you should store this information on the stack with the color of the gumball—so a gumball info consists of a color together with a number.)
How would u go about moving them in order then creating this other stack to hold the gumballs moved with a counter?
How would u implement a gumball stack that consists of a color and a counter... how do you search within a stack?? each time a gumball is eaten or u move the gumballs, the counter increases.