Recursion

“Well … imagine the model train you had as a child. The train went round and round without an obvious beginning or end.”

“OK”

“As the train goes around the track, it passes schools, street crossings, whatever.”

“OK”

“Now imagine that each time the train passes the school or street crossing that some computation is made or some counter is advanced. Do you follow so far?”

“Yes”

“Now imagine that the train saves the output from the calculation or counter and provides it as input the next time it passes the school or street crossing. Understand?”

“Yes, but what is recursion?”

Leave a comment ... or else ...

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 )

Facebook photo

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

Connecting to %s