<span>A selective backup allows a user to choose specific files to back up, regardless of whether or not the files have been changed.</span>
Can you add a picture of the options
This is the Composite pattern, one of the "Gang-of-Four" design patterns (check out their book!).
Answer:
One approach would be to move all items from stack1 to stack2 (effectively reversing the items), then pop the top item from stack2 and then put them back.
Assume you use stack1 for enqueueing. So enqueue(x) = stack1.push(x).
Dequeueing would be:
- For all items in stack1: pop them from stack1 and push them in stack 2.
- Pop one item from stack2, which will be your dequeue result
- For all items in stack2: pop them from stack2 and push them in stack 1.
Hope it makes sense. I'm sure you can draw a diagram.