Exercises: Trees
Feb 262018Before attempting these exercises, you should read the posts about trees and ways to think about trees.
Exercises
- Which of the following are tree structures? Explain your answers.
- Books in a library, organised by category.
- Employees in a company, organised by who is each person’s manager.
- Linked lists.
- Words in the English language, organised by prefixes — for example, “cat” is a prefix of “catalyst”.
- Classes and subclasses in an object-oriented program.
- For each of the tree structures you identified in question 1., make up some example data, and draw a diagram to visualise it as a tree.
- Draw node/link diagrams for the following tree structures:
- The tree representing the expression
2*x + 3*(y+4)
. - The directories and files in this git repository.
- The exercises listed on this page. (Label the nodes with question numbers, or very short descriptions.)
- The tree representing the expression
There are no published comments.