- #1
ZERO_COOL
- 17
- 0
I cannot get my head around this at all.
Suppose that v is of type Vector of Integers and we know the following:-
1. v is sorted.
2. No two items in v are the same.
3. v.at(1) is 12.
For an integer n, where 1 <= n <= v.size(), let p(n) be the following proposition: p(n): v.at(n) => 11 + n.
A. Explain why p(1) is true?
B. suppose that p(k - 1) is true (where 1 < k <= v.size()). Explain why p(k) must then be true.
C. Complete a proof that p(n) is true for all integers n with 1 <= n < v.size().
For A. I have,
In plain English the proposition means,
The n at position n in v is greater than or equal to 11 + n.
Let n = 1.
P(1): v.at(1) ≥ 11 + 1 = 12. (B)
From statement 3 which indicates v.at(1) is 12 and statement 2 which indicates no two items in v are the same, the above statement proves p(1) is true.
I'm struggling with the Inductive hypothesis (question b).
Suppose that v is of type Vector of Integers and we know the following:-
1. v is sorted.
2. No two items in v are the same.
3. v.at(1) is 12.
For an integer n, where 1 <= n <= v.size(), let p(n) be the following proposition: p(n): v.at(n) => 11 + n.
A. Explain why p(1) is true?
B. suppose that p(k - 1) is true (where 1 < k <= v.size()). Explain why p(k) must then be true.
C. Complete a proof that p(n) is true for all integers n with 1 <= n < v.size().
For A. I have,
In plain English the proposition means,
The n at position n in v is greater than or equal to 11 + n.
Let n = 1.
P(1): v.at(1) ≥ 11 + 1 = 12. (B)
From statement 3 which indicates v.at(1) is 12 and statement 2 which indicates no two items in v are the same, the above statement proves p(1) is true.
I'm struggling with the Inductive hypothesis (question b).