Question

# General Structural Induction

A graph (V,E) consists of a set of vertices V and a set of edges E, where each

edge is a pair of vertices in V . (If you are not familiar with the concept of graphs, you can think of the vertices as dots and the edges as lines, that connect the dots.) We let V = {vi | i ∈ N} = {v1,v2,v3,...} be a set of (countably many) possible vertices. A tree is a graph that has no circles. A (full) binary tree is a special type of tree, that consists of a special node root, a set of several inner nodes (which includes the root), and a set of leaves, which are not inner nodes. Every inner node v has exactly two children, a left child and a right child, denoted by left(v) and right(v). The set of full binary trees can be deﬁned inductively (inside the universe of all graphs): • Universe The set of all graphs with vertices in V. • Core set Graphs ({r,left(r),right(r)},{(r,left(r)),(r,right(r))}) that contain a single root vertex r, its two children, and two edges between the root and its children. The root node r is the only inner node and {left(r),right(r)} is the set of leaf nodes of this binary tree. • Operations 1. expand((V,E),v) which takes a binary tree (V,E), and one of its leaf nodes v ∈ V as input, and outputs expand((V,E),v) = ((V ∪{left(v),right(v)},E ∪{(v,left(v)),(v,right(v))}). that is, this operation adds two new nodes left(v) / ∈ V and right(v) / ∈ V aschildren to the node v, and adds an edge between v and its new children. v then becomes an inner node and the children become leaf nodes. 2. join((V,E),(V 0,E0),r,r0) which takes two binary trees (V,E) and (V 0,E0) and their root nodes, such that V ∩V 0 = ∅, and outputs join((V,E),(V 0,E0),r,r0) = (V ∪V 0∪{rnew},E∪E0∪{(rnew,r),(rnew,r0)}). That is, this operation creates a new binary tree by adding a new root node rnew / ∈ V ∪V 0 and adds edges between the new root and the two old root nodes (that now become the children of rnew. The set of leaf nodes of the newly created tree is the union of the two leaf sets of the input trees.

Prove (inductively over the structure deﬁned above) that the following property holds for the set of full binary trees T: • The set of edges is twice the number of leaves minus 2. |E(T)| = 2·|L(T)|−2 where E(T) denotes the number of edges in the tree T and L(T) denotes the number of its leaf nodes.

### Recently Asked Questions

- In Raptor, input a list of positive numbers, terminated by 0, into an array Numbers [ ]. Then display the array and the largest and smallest number in it.

- Select one or more of the following statements about scaling up and scaling out that are true. (more than one answer) A. An organization that wants to be able

- The ________ is a program that's called when the CPU detects an interrupt.It saves the current machine state and transfers control to the appropriate interrupt