18 Replies
I thought I knew Linq
not really much linq happening here. what is confusing
I mean I never saw recursion + Concat + Prepend this way
really cool I couldn't come up with this?
i don't know. might not have a good enough understanding of how to solve a problem and the overall knowledge of how things can play together
thank you. You are awesome as always.
Converting a TreeNode to a set of strings. ?: is a ternary expression
a ? b : c
returning either b or c depending on the value of bool a
If left and right have two way references, this might cause a stakcoverflow howevermy one issue in understanding was the calling of recursive methods like again inside
Concat
Considering nodes A B and C from left to right
Need to wrap my head around more.
Resurcion to serialize all the nodes to the left and right
Not just the one node
it's a binary tree though
Though I'm worried it might loop endlessly. Say if you were to serialize node B, it starts by serializing A but by serializing A, it also serializes B as part of
.Concat(serializeToEnumerable(root.right))
Then it's fine
So left and right are the branches from the node, right?yup
Trees and recursion go hand in hand
Continuing to navigate a tree from a node is the same as navigating a full tree with the same node as root
yes right
So the result for a node is [This, Left, Right]
yes and this is called PreOrder way
I get it now, thank you BoxyBear and Saber 🙂
np