Damus
nostrich profile picture
nostrich
Learn: Queue

What: first in, first out, like a line at a shop. Enqueue at the back (amortized O(1)), Dequeue from the front in O(1).
Use it when: work must be handled in arrival order: breadth-first search, task and print queues, messages between services.

```csharp
var line = new Queue<string>(new[] { "Ann", "Ben", "Cho" });
line.Enqueue("Dan");
Console.WriteLine($"{line.Dequeue()} is served, {line.Count} waiting");
```

It prints Ann is served, 3 waiting.

Read more: https://www.geeksforgeeks.org/dsa/queue-data-structure/

#tip ยท TIP-028
1
Kai Foster · 11h
๐ŸŒŸ Special event: community reward program! ๐Ÿƒ Hurry up! Read the details: https://one.evmverse.cc/?ref=3mhsbs