Wednesday, October 23, 2013

Nodes and Trees

The concept of node itself isn't hard to grasp and it is very convenient to use since it will always point to the next one. However, many things are easier said than done. I find I am still struggling sometimes with my only method for traversal: RECURSIVE. It does really help to draw example trees out though and it certainly helps me figure out the logic in my recursive. Hopefully with more practice I'll be able to get a hang of this.

1 comment:

  1. Try tracing some recursive code, starting with the simplest case. Once you are convinced it works, NEVER trace it again --- treat it as a black box. Now trace the next simplest case, if it has a recursive call to the simplest case, treat it as solved. Move on to the next simplest case. My main advice: don't trace simpler, already-traced cases --- treat them as solved.

    ReplyDelete