This week we had an exercise on
building trees, as lists from their nodes in a certain order, and
finding the sum of the 'deepest' leaf. I found this to be the first
exercise that I would describe as quite challenging. I'm not sure if
it was because of my lack of knowledge about the techniques or a lack
of programming intuition but I definitely struggled with the two
functions mentioned above.
I can't help but wonder if this is what
programming in 'the wild' will feel like. Encountering something that
wasn't just designed to be worked through as an exercise or
assignment, but a real world problem that might not actually have a
solution until I come up with one! It's kind of scary but at the same
time exciting to think of being able to tackle these types of
challenges.
In the end, after I devised a solution,
the functions weren't actually all that complicated looking.
Although, when you're sitting at the computer just watching the
cursor blink it seems like the solution might allude you for all
eternity.
Without saying too much about the
solutions to the problems; if your looking to build a tree from an
ordered list – slice it up! If you're looking to do something to
the values in a tree – keep track of them during recursion!
No comments:
Post a Comment