CS 173: Skills list for Examlet 9
Trees
- Define a (full) binary tree recursively: it's either a single node, or a root with two subtrees children, or (for non-full trees) a root with one subtree child.
- Define and use tree terminology: root, leaf, internal node, parent, child, sibling, (proper) ancestor, (proper) descendent, level of a node, height of tree.
- Define what it means for a tree to be binary, n-ary, or balanced. (The definitions for "full" and "complete" trees will be provided.)
- Know key facts: a tree has one more node than edges, a full m-ary tree with i internal nodes has mi+1 nodes total, a full binary tree with n internal nodes has n+1 leaves (and thus 2n+1 nodes total),
- Know key facts about binary trees of height h: the number of leaves is between 1 and 2h, the number of nodes is between (h+1) and (2h+1 - 1)
- Know that the height of a full complete binary tree with n nodes (or n leaves) is approximately log(n).
String notation and regular expressions
- The empty string (ε)
- Know what a "bit string" is (a string of ones and zeroes)
Grammar Trees
- Correctly interpret the definition of a context-free grammar: variables, rules, start symbols, terminal symbols
- Correctly interpret a grammar rule, e.g. what does ε or a vertical bar mean on the righthand side of a rule.
- Given a grammar G, give examples of trees that are/aren't generated by G, determine whether a given tree could be generated by G.
- Given a string s and a grammar G, briefly explain why s can/can't be generated by G.
- Build a tree matching grammar G with a specific terminal string s. When multiple trees are possible, build more than one or describe the set of possible trees.
Tree Induction
- Prove a claim about labelled or unlabelled trees using induction.
- Use induction to prove a claim about other sorts of objects, where your induction variable is the size of the object and there may be more than one object of each size.