PREV INDEX NEXT

Author: Unknown
Subject: 3 Deque Limit
Date: Thursday, 02 Apr 2020, 05:03:54

I've gotten my code working using unlimited queues, where 2 new ones are made per recursive call, but I'm having a really hard time translating that into a solution that only uses 2 stacks and 1 queue. I'm trying to use tip #4 about using partially full stacks as empty ones (and keeping track of how many items you push onto them), but that only makes sense to me if you limit yourself to 3 stacks and 0 queues. The 1 queue is messing things up because it keeps reversing orders when moving items onto it from a stack, which messes up stable sorting. Do you have any suggestions on how I should approach this?
PREV INDEX NEXT