Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
The description tells you the implementation of the tree:
You are passed the root node of the tree as input.
Would be nice to know which format is expected for the tree as input.
This question is better fit to be 5kyu
Actually question is very easy, its just level order traversal
But BT is a concept where many people dont know it in there initial days coding ..
it is very easy, really 4kyu?
@trashy_incel thx very much
what makes your code crash is that it does not safely handle the empty tree (
NULL).other than that your algorithm is incorrect. you are using the queue as a stack, so you are performing a depth-first traversal instead of a breadth-first one
Have no idea why my return falls https://pastebin.com/3guS0MbH
array is correct
https://ibb.co/spnLqQxS
https://ibb.co/wFNfGTDP
there are now sample tests in Ruby and the assertions use RSpec. the only thing missing is random tests
Just copy the struct and create the simple methods for creating the children nodes.
Something like this:
the level for this kata is too high. if the task involved creating a queue class on its own, then it would be 4kyu, otherwise it would be 6kyu.
This comment is hidden because it contains spoiler information about the solution
I had the same issue while reading at first
I misinterpreted the instructions. I thought we were supposed to get the values from each level, sort them, and then put the levels in order, this way the values in each level of the tree would be sorted as opposed to being in the same order they were in the tree. The examples given and the sample tests did not rule out this interpretation.
Great Kata!
Loading more items...