when n is a positive integer. 19. By taking
determinants of both sides of the
equation in Exercise 18, prove the identity
given in Exercise 14. (Recall that the
determinant of the matrix a b c d is ad
recursively by Basis step: (0, 0) S.
Recursive step: If (a, b) S, then (a + 2, b
+ 3) S and (a + 3, b + 2) S. a) List the
elements of S produced by the first five
applications of the recursive definit
of 5 and of 6 using this recursive
definition. Consider an inductive
definition of a version ofAckermanns
function. This function was named after
WilhelmAckermann, a German
mathematician who was a stu
number of vertices in a full binary tree,
we observe that n(T ) satisfies the
following recursive formula: BASIS STEP:
The number of vertices n(T ) of the full
binary tree T consisting of only a root
definition you found is correct. [Hint: To
find a recursive definition, plot the points
in the set in the plane and look for
patterns.] a) S = cfw_(a, b)| a Z+, b Z+,
and a + b is even b) S = cfw_(a,
the root to each of the roots of the left
subtree T1 and the right subtree T2.
Figure 4 shows how full binary trees are
built up by applying the recursive step
one and two times. Structural Induction
contain an equal number of left and right
parentheses. RECURSIVE STEP: Assume p
and q are well-formed formulae each
containing an equal number of left and
right parentheses. That is, if lp and lq are
hypothesis, l(xy) = l(x) + l(y). We conclude
that l(xya) = l(x) + l(y) + 1 = l(x) + l(ya).
We can prove results about trees or
special classes of trees using structural
induction. For example, to pro
formed formulae. For example, by the
basis step we know that T, F, p, and q are
well-formed formulae, where p and q are
propositional variables. From an initial
application of the recursive step, we k
Mathematical induction, and its variant
strong induction, can be used to prove
that a recursive algorithm is correct, that
is, that it produces the desired output for
all possible input values. Exampl
graph formed by starting with a root r,
which is not in any of the rooted trees T1,
T2,.,Tn, and adding an edge from r to
each of the vertices r1, r2,.,rn, is also a
rooted tree. In Figure 2 we illust
step of the definition specifies that 3 is in
S. Because 3 = 3 1, all elements specified
to be in S in this step are divisible by 3
and are therefore in A. To finish the proof,
we must show that all i
members of a set constructed recursively
have a particular property. We will
illustrate this idea by using structural
induction to prove results about wellformed formulae, strings, and binary
trees. F
recursive definition of a function f from
the set of nonnegative integers to the set
of integers. If f is well defined, find a
formula for f (n) when n is a nonnegative
integer and prove that your for
recursively by f (0) = 1 and for n = 0, 1, 2,.
a) f (n + 1) = f (n) + 2. b) f (n + 1) = 3f (n).
c) f (n + 1) = 2f (n). d) f (n + 1) = f (n)2 + f
(n) + 1. 2. Find f (1), f (2), f (3), f (4), and f
(5)
or numeral). Well-formed formulae
generated by applying the recursive step
once include (x + 3), (3 + y), (x y), (3
0), (x 3), (3 y), (3/0), (x/y), (3x), and
(03). Applying the recursive step twice
s
in algorithms for compressing data, and in
many other applications. We first define
extended binary trees. DEFINITION 4 The
set of extended binary trees can be
defined recursively by these steps: BASI
holds for these new elements. The validity
of structural induction follows from the
principle of mathematical induction for
the nonnegative integers. To see this, let P
(n) state that the claim is tru
by the recursive definition of h(T ) =
2h(T )+1 1. This completes the recursive
step. Generalized Induction We can
extend mathematical induction to prove
results about other sets that have the
wellord
length n + 1 as xy, where x is a string of
length n, and express the reversal of w in
terms of xR and y.] 36. Use structural
induction to prove that (w1w2)R = wR 2
wR 1 . 37. Give a recursive definiti
3, which is a recursive version of the
Euclidean algorithm. We illustrate the
workings of Algorithm 3 with a trace
when the input is a = 5, b = 8. With this
input, the algorithm uses the else clause
t
deal with iterations of the logarithm
function. Let log n denote the logarithm of
n to the base 2, as usual. The function
log(k) n is defined recursively by log(k) n
= n if k = 0 log(log(k1)
n) if log
element in the first list into the second
list. This requires only log n comparisons,
which is much smaller than m + n 1 = n,
for m = 1. On the other hand, for some
values of m and n, Lemma 1 gives th
remove it from the second list. At this
stage the first list is 5, 6, the second list is
empty, and the combined list is 1, 2, 3, 4.
Finally, because the second list is empty,
all elements of the firs
T2 is the union of the sets of leaves of T1
and of T2. The internal vertices of T are
the root r of T and the union of the set of
internal vertices of T1 and the set of
internal vertices of T2. 44. Us
mergesort(L = a1,.,an) if n > 1 then m :=
n/2 L1 := a1, a2,.,am L2 := am+1,
am+2,.,an L := merge(mergesort(L1),
mergesort(L2) cfw_L is now sorted into
elements in nondecreasing order An
efficient algo
1960, taking a job at a small computer
manufacturer, where he wrote a
compiler for the programming
language Algol. In 1968, he became
Professor of Computing Science at the
Queens University, Belfast;
integer. Find a formula for f (k)(n). What
is the value of f 0 (n) when n is a
positive integer? 64. Let f (n) = n/2. Find a
formula for f (k)(n). What is the value of f
1 (n) when n is a positive in
done in Example 1 to find 4!. 2. Trace
Algorithm 1 when it is given n = 6 as
input. That is, show all steps used by
Algorithm 1 to find 6!, as is done in
Example 1 to find 4!. 3. Trace Algorithm 3
whe