|
Not that it makes a huge difference, but I think the "let sort" part may benefit from let-else. Also, in the second block you can just code:
Moonlit Knight fucked around with this message at 00:38 on Sep 30, 2023 |
# ¿ Sep 30, 2023 00:33 |
|
|
# ¿ Apr 29, 2024 13:39 |
|
Why k - 1? For k = 1 every child should be removed in order, but in your code, idx would be constant, right? Edit: oh, got it. You need to decrement the index because the queue has one fewer element. Moonlit Knight fucked around with this message at 23:14 on Dec 11, 2023 |
# ¿ Dec 11, 2023 23:12 |
|
I think scroll is a popular crate for this kind of usecase. You might also want to have a look st zerocopy or watto (disclaimer: I worked on watto).
|
# ¿ Dec 16, 2023 20:23 |