Question

Problem 3 - use the following definition of permutation below: List A is a permutation of...

Problem 3 - use the following definition of permutation below:

List A is a permutation of list B if any of the following are true:

- list A and list B are both null, otherwise

- a.head=b.head, and a.tail is a permutation of b.tail

- a.head≠b.head, and there exists a list C such that

- a.tail is a permutation of b.head:c, and

- b.tail is a permutation of a.head:c

a) Use induction to prove that any finite list is a permutation of itself-in other words, that the permutation relation is reflexive.

b) Using the recursive definition of permutation above, use induction to prove that if list a is a permutation of list b, then list b is a permutation of list a-in other words, that the permutation relation is symmetric.

Homework Answers

Answer #1

Defintion of permutation of list : List a is a permutation of list b if any of the following are true: CASE 1) both lists are null, CASE 2) a.head = b.head, and a.tail is a permutation of b.tail, CASE 3) a.head ≠ b.head and there exists another list.

Your base case is when the list is null. Assume that the property holds for a list of length

nn, and look at lists of length n+1n+1.

Now we can split the list into head and tail. The tail is a list of length nn. Apply the above definitions, but keep in mind that a=ba=b.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
QUESTION 1 For the following recursive function, find f(5): int f(int n) { if (n ==...
QUESTION 1 For the following recursive function, find f(5): int f(int n) { if (n == 0)    return 0; else    return n * f(n - 1); } A. 120 B. 60 C. 1 D. 0 10 points    QUESTION 2 Which of the following statements could describe the general (recursive) case of a recursive algorithm? In the following recursive function, which line(s) represent the general (recursive) case? void PrintIt(int n ) // line 1 { // line 2...
) Let α be a fixed positive real number, α > 0. For a sequence {xn},...
) Let α be a fixed positive real number, α > 0. For a sequence {xn}, let x1 > √ α, and define x2, x3, x4, · · · by the following recurrence relation xn+1 = 1 2 xn + α xn (a) Prove that {xn} decreases monotonically (in other words, xn+1 − xn ≤ 0 for all n). (b) Prove that {xn} is bounded from below. (Hint: use proof by induction to show xn > √ α for all...
A list of economic terms is shown below. Match each term with its definition. A. Production...
A list of economic terms is shown below. Match each term with its definition. A. Production B. Physical Capital C. Short run D. Long run E. Marginal product F. Specialization G. Law of diminishing returns Place the letter that is shown in front of each term above with that? term's definition. Use only the appropriate letter. Do not write out the term or include the period after the letter. Letter Definition 1. ?Increases in inputs eventually lead to less additional...
Write a Turing-machine style of algorithm to decide the language L1 given below. Use specific, precise,...
Write a Turing-machine style of algorithm to decide the language L1 given below. Use specific, precise, step-by-step English. So, describe how to test whether or not an input string is in the language L1 in finite time. No need to write a state diagram. L1 = {w : every ‘a’ within w is to the left of every ‘b’ within w} over the following alphabet Σ = {a, b, c}. In other words, you’re not allowed to have any ‘b’...
Prove that for a square n ×n matrix A, Ax = b (1) has one and...
Prove that for a square n ×n matrix A, Ax = b (1) has one and only one solution if and only if A is invertible; i.e., that there exists a matrix n ×n matrix B such that AB = I = B A. NOTE 01: The statement or theorem is of the form P iff Q, where P is the statement “Equation (1) has a unique solution” and Q is the statement “The matrix A is invertible”. This means...
I'm working in a 6 page research paper and below is the complete list of the...
I'm working in a 6 page research paper and below is the complete list of the paper has to be set up and the required things needed to be included. Can you check to see what is already included on the list and what is missing in my paper. Also, what I need to improve and how? My topic is "The Struggles of Epilepsy". Can you help me with the content (background, empirical research, and hypothesis )? I also need...
Use the following statements to answer the question: I. Consider the problem of negotiating the price...
Use the following statements to answer the question: I. Consider the problem of negotiating the price of a rug that costs $200 to make. If there are two buyers (one with a maximum willingness-to-pay of $200 and one with a maximum willingness-to-pay of $250), then the situation is a noncooperative game. II. The likely outcome from the game described in statement I is that the second buyer will bid a price slightly above $200 (e.g., $201) to win the rug.               ...
Please use the information below for the following questions: Twenty pediatric patients were asked if they...
Please use the information below for the following questions: Twenty pediatric patients were asked if they live with both parents (B), mother only (M), father only (F), or someone else (S). The responses were as follows: M B B M F S B M F M B F B M M B B F B M a. Determine the frequency for patients who live with both parents 8 , mother only 7 , father only 4 , or someone else...
#Linked Lists and Classes #C++ Hi, please use singly linked list method to do this question....
#Linked Lists and Classes #C++ Hi, please use singly linked list method to do this question. Thank you! Here’s the contents of a file called example.cpp: // example.cpp #include "LinkedList.h" #include <iostream> #include <string> using namespace std; int main() { cout << "Please enter some words (ctrl-d to stop):\n"; LinkedList lst; int count = 0; string s; while (cin >> s) { count++; lst.add(remove_non_letters(s)); } // while cout << "\n" << count << " total words read in\n"; cout <<...
Problem 2: Python 3 Implement a function called gee_whiz that does the following: given argument n,...
Problem 2: Python 3 Implement a function called gee_whiz that does the following: given argument n, a positive integer, it returns a list of n tuples corresponding to the numbers 1 through n (both inclusive): the tuple for the number k consists of k as the first component, and exactly one of the following strings as the second: • the string 'two!' if k is divisible by 2 • the string 'three!' if k is divisible by 3 • the...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT