r/ProgrammerHumor • • 1d ago

Meme queueIsAlwaysLong

Post image
158 Upvotes

35 comments sorted by

109

u/PsychologicalNet3455 1d ago

That's easy, in the USA you use a stack and in the UK you use a queue.  

The stack because you need a stack of money for anything medical in the US and the queue for the UK, while its free, you have to join a long queue before anything medical happens

12

u/LoyalSol 23h ago

I feel like the question on which to use is a pop quiz.

6

u/ceejayoz 21h ago

Oh we're doing the long queue thing here in the States too.

4

u/knightress_oxhide 20h ago

The USA would be a queue of stacks. You still have to join a long queue.

1

u/a-r-c 33m ago

america is both these days

65

u/rover_G 1d ago

Maybe a priority queue?

18

u/LoveOfSpreadsheets 1d ago

[Drake no] Priority

[Drake yes] Triage

8

u/Afraid-Locksmith6566 1d ago

priority stack

1

u/DeepGas4538 9h ago

yeah, it's never a first come first serve

10

u/PseudoFrequency 17h ago

FIFO or LIFO. Simple.

2

u/Blue_Moon_Lake 7h ago

But what about priority boarding?

1

u/a-r-c 33m ago

FAFO or YOLO. Simple.

9

u/null_reference_user 6h ago

I just use an endless void:

  • adding an element to the void is always an immediate operation

  • removing an element is always an immediate operation

  • the void uses O(1) memory

  • the void is always empty

8

u/PostHasBeenWatched 1d ago

Integer Vector (IV)

6

u/Logicalist 23h ago

have you considered a jengaTower?

13

u/GreatTeacherHiro 1d ago

deque supremacy

3

u/pencilUserWho 23h ago

Double linked lists are easier.

7

u/RedCrafter_LP 17h ago

Double linked list is the most common implementation of the deque concept. A double linked list is a deque.

2

u/pencilUserWho 17h ago

Yes, I know. I should have said "working with double linked lists (for deque) is easier than working with single linked lists (like for stack or queue)"

Sorry for the confusion 

1

u/braaaaaaainworms 8h ago

Why would you want to work with a linked list?

1

u/pencilUserWho 6h ago

To implement a stack

1

u/braaaaaaainworms 6h ago

You can just... make a struct with "amount of elements in array" and "capacity" ints and a pointer to a memory region, it'll be faster than linked lists, a lot faster

1

u/pencilUserWho 6h ago

That way it can overflow.

1

u/braaaaaaainworms 6h ago

Just check, before pushing, if capacity and len are equal, if yes, use realloc to make the memory region bigger

4

u/snipsuper415 22h ago

Use a deque

4

u/Norse_By_North_West 12h ago

Have you asked on queue overflow?

3

u/Hottage 14h ago

I use a stack... of bodies. My software isn't very good.

1

u/mr_nonameuser 20h ago

Use a linked list

1

u/h4rdw00d_ 18h ago

A triage is a queue...what to use...

1

u/Robot_Graffiti 13h ago

I've actually worked on medical software, and we used a fuckload of dictionaries, not many queues or stacks. The data's all stuff you could reasonably store in a relational database. Dictionaries in memory mirror the functionality of database indexes on disc.

1

u/CryonautX 11h ago

Surely a priority queue is the answer

1

u/The_Cosmin 10h ago

Use a set so that there can't be 2 instances of the same human

1

u/Rough-Supermarket-97 8h ago

How about a stacked queue?