Purchase Solution

Recursive definition

Not what you're looking for?

Ask Custom Question

We can define sorted lists of integers as follows:

Basis - A list consisting of a single integer is sorted.

Induction - If L is a sorted list in which the last element is a and if b >= a, then L followed by b is a sorted list.

Prove that this recursive definition of "sorted list" is equivalent to our original, nonrecursive definition, which is that the list consist of integers

a1 <= a2 <= .... <= an

Remember, you need to prove to parts:

(a) If a list is sorted by the recursive definition, then it is sorted by the nonrecursive definition

(b) if a list is sorted by the nonrecursive definition, then it is sorted by the recursive definition.

Part(a) can use induction on the number of times the recursive rule is used, and (b) can use induction on the length of the list.

Purchase this Solution

Solution Summary

This is a proof regarding recursive definitions and integers.

Solution Preview

(a) Recursive => Non-recursive
Prove by induction:
Let a list{a_1,a_2,a_3,...a_n}be a sorted list defined by the recursive definition.
(1) Let L_1=a_1, and the last element is a_1, which is sorted. Followed by a_2, satisfying a_1<=a_2, therefore L_2= {a_1,a_2},satisfying a_1<=a_2, which is sorted by the non-recursive ...

Purchase this Solution


Free BrainMass Quizzes
Exponential Expressions

In this quiz, you will have a chance to practice basic terminology of exponential expressions and how to evaluate them.

Solving quadratic inequalities

This quiz test you on how well you are familiar with solving quadratic inequalities.

Multiplying Complex Numbers

This is a short quiz to check your understanding of multiplication of complex numbers in rectangular form.

Geometry - Real Life Application Problems

Understanding of how geometry applies to in real-world contexts

Probability Quiz

Some questions on probability