recursion – whiteboard coding IV tips

– spend some time writing down the external interface of the recursive func — exactly what to print/return, and what global variables to update.

– define end-of-recursion condition explicitly. Interviewers want to see that.

– list all important local variables vs global variables on the side. Some variables must be local — on the stack. All others had better be global.

– instance variables should usually be global like static?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s