3 ms·
I read the code before I made my comment. It does exactly what I described.
by Arnavion 2y ago
I read the code before I made my comment. It does exactly what I described.
- kragen 2y agoThat sounds like pathologically bad behavior, using an amortized-linearly growing amount of memory to hold a constant amount of data? (Moreover, this is perhaps the most common use case for a queue.) It may be a correct description of the code, but it can't be a correct algorithm.
- Arnavion 2y agoYes.