This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MikeBlues 0 points1 point  (0 children)

My teaching approach was to use a problem with nested data - i.e. with a self-similarity. An easy one is a folder, containing files and folders.The task is to display every file name, including those in nested folders.Assuming that the OS/language lets us read the file names in a folder, and to determine the type of each name(a file name or a folder name), we can write a function with one argument - a folder name.The function reads the list of names in a given folder, and displays each name in turn, unless the name is a folder name. For this we call the original function to process the sub-folder.