David Rowley <dgrowleyml@gmail.com>, 11 Tem 2024 Per, 04:16 tarihinde şunu yazdı:
I did a bit more work in the attached. I changed "level" to be 1-based and because it's the column before "path" I find it much more intuitive (assuming no prior knowledge) that the "path" column relates to "level" somehow as it's easy to see that "level" is the same number as the number of elements in "path". With 0-based levels, that's not the case.
Please see the attached patch. I didn't update any documentation.
I updated documentation for path and level columns and also fixed the tests as level starts from 1.
I don't think we need this outer while loop. Appending to the end of a queue naturally results in top-to-bottom order anyway, keeping two lists, "queue" and "nextQueue", might not be necessary. I believe that it's safe to append to a list while iterating over that list in a foreach loop. v9 removes nextQueue and appends directly into queue.