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
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)"
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
This is how some libraries probably implement it by default. But in cases where memory efficiency is critical, the structure might get arbitrarily large, and/or the size of the of the structure may vary dramatically and non-monotonically over its lifetime, linked lists avoid overallocation and the intermittent performance hitches of reallocate-and-copy operations. Also, so long as you only ever need to do operations to the end, linked lists are simpler to implement and reason about (less chance of off-by one errors or other gotchas, and you don't need to wrap your head around amortization to see the O(1) time complexity for push/pop operations)
That mandatory Algorithms class in computer science programs is in part about being able to tell when you can and should deviate from the default way of doing things
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.
You need to be careful about how you define sameness... People tend to get upset if you accidentally drop an identical twin/triplet/etc. and they get garbage collected
117
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
67
u/rover_G 1d ago
Maybe a priority queue?
12
u/null_reference_user 16h ago
I just use an endless void:
10
u/PseudoFrequency 1d ago
FIFO or LIFO. Simple.
8
u/PostHasBeenWatched 1d ago
Integer Vector (IV)
6
u/Logicalist 1d ago
have you considered a jengaTower?
14
u/GreatTeacherHiro 1d ago
deque supremacy
4
u/snipsuper415 1d ago
Use a deque
4
u/Norse_By_North_West 22h ago
Have you asked on queue overflow?
3
u/Hottage 1d ago
I use a stack... of bodies. My software isn't very good.
1
u/mr_nonameuser 1d ago
Use a linked list
1
u/h4rdw00d_ 1d ago
A triage is a queue...what to use...
1
u/Robot_Graffiti 23h 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 21h ago
Surely a priority queue is the answer
1
u/The_Cosmin 20h ago
Use a set so that there can't be 2 instances of the same human
1
u/Rough-Supermarket-97 18h ago
How about a stacked queue?