Here's a data-structure I use almost every day. It's an implementation¹ of a
queue. You have two stacks, an in-stack and an out-stack. To add a new item, push it onto the in-stack. To remove an item, take the top item off the out-stack; if the out-stack's empty, push all the items on the in-stack onto the out-stack in reverse order and then take
(
Read more... )
Comments 17
Reply
Reply
Are your t-shirts immutable?
Reply
Reply
Reply
Reply
Reply
Reply
Reply
Reply
Reply
Reply
Reply
Leave a comment