If You Love Queuing, Will You Also Love Priority Queuing? • [Club]
thepythoncodingstack.com
·16h
🔗Topological Sorting
Preview
Report Post

You provide three tiers to your customers: Gold, Silver, and Bronze. And one of the perks of the higher tiers is priority over the others when your customers need you.

Gold customers get served first. When no Gold customers are waiting, you serve Silver customers. Bronze customers get served when there’s no one in the upper tiers waiting.

How do you set up this queue in your Python program?

You need to consider which data structure to use to keep track of the waiting customers and what code you’ll need to write to keep track of the complex queuing rules.

Sure, you could keep three separate lists (or better still, three `deque` objects). But that’s not fun! And what if you had more than thre…

Similar Posts

Loading similar posts...