Is this allowed in substitution

  • Thread starter Thread starter Ad2d
  • Start date Start date
  • Tags Tags
    Substitution
Click For Summary

Homework Help Overview

The discussion revolves around a recurrence relation problem involving the function f(n) defined by f(n) = 0 for n=1 and f(n) = 2f(n/2) + n - 1. Participants are comparing their approaches to solving this recurrence and questioning the validity of different substitutions made during the process.

Discussion Character

  • Exploratory, Assumption checking, Problem interpretation

Approaches and Questions Raised

  • The original poster attempts to clarify their substitution method and whether it aligns with the teaching assistant's (TA) approach. They express confusion over the differences in their results, particularly regarding the constants used in their equations. Other participants question the original poster's notation and assumptions, particularly around the use of k and the implications of letting n be a power of 2.

Discussion Status

Participants are actively engaging with each other's reasoning, with some providing clarifications and questioning the assumptions made in the substitutions. There is no explicit consensus yet, but the discussion is exploring various interpretations of the recurrence relation and the implications of the substitutions made.

Contextual Notes

There is a recognition that the original poster's approach may not cover all natural numbers due to the assumption of n being a power of 2. Additionally, the context of the problem being related to merge sort is noted, which may influence the reasoning around the substitutions and the need for even division.

Ad2d
Messages
9
Reaction score
0

Homework Statement


I have recurrence relation problem and what to ask would my way be just as correct as the TA did the solution:

f(n) = 0, n=1 and 2f(n/2) + n -1

The Attempt at a Solution



Here we assume n = 2k

This is my way:

f(k-1) = 2[2f(2k-2)*2k-1-1] + 2k - 1

= 4(f(2k-2) * (2*2k) - 3
:
:
= 2j*f(2k-j) + j2k - (j-1)

Guess: j=k
2j*f(2j-j) + j2j - (j-1)
2jf(1)+ j2j - (j-1)

j2j - (j-1) = j2j - j + 1 = j(2j)

The TA way

She did the same thing I did but in the part where we have
= 4(f(2k-2) * (2*2k) - 3

she put

= 4(f(2k-2) * (2*2k) - 22 + 1

where my guess came to be j(2j) she gets 2j(j-1) +1

Is her way correct where instead of putting the -3 she put the -22 + 1 ?
 
Last edited:
Physics news on Phys.org
f(n) = 0, n=1 and 2f(n/2) + n -1

I don't understand what you wrote. Can you rephrase? I fail to see the "recurrence".
 
Ad2d said:

Homework Statement


I have recurrence relation problem and what to ask would my way be just as correct as the TA did the solution:

f(n) = 0, n=1 and 2f(n/2) + n -1
Do you mean f(n)= 2f(n/2)+ n- 1?

The Attempt at a Solution



Here we assume n = 2k

This is my way:

f(k-1) = 2[2f(2k-2)*2k-1-1] + 2k - 1
Why k-1? If n= ek, tnen f(n)= f(2k-1). How did you reduce it to "f(k-1)"? Putting n= 2k would give n/2= 2k-1. Is that what you meant?
Are you relabeling f(n)= f(2k) as f(k)? That can be done but you must say so: and it would be better to use a different symbol as you now have a different function: let g(k)= f(2[/sup]k[/sup]). And, of course, since most natural numbers are NOT powers of 2, letting k be a natural number will not give all values of n.

= 4(f(2k-2) * (2*2k) - 3
:
:
= 2j*f(2k-j) + j2k - (j-1)

Guess: j=k
2j*f(2j-j) + j2j - (j-1)
2jf(1)+ j2j - (j-1)

j2j - (j-1) = j2j - j + 1 = j(2j)

The TA way

She did the same thing I did but in the part where we have
= 4(f(2k-2) * (2*2k) - 3

she put

= 4(f(2k-2) * (2*2k) - 22 + 1

where my guess came to be j(2j) she gets 2j(j-1) +1

Is her way correct where instead of putting the -3 she put the -22 + 1 ?
 
Sorry for the confusion. You right when you stated that when n=2k that f(n/2) becomes f(2k/2) which goes to f(2k-1).

For the f(n-1) I may have skipped a step when substitution. I meant to say:
f(k) =2f(2k-1). + 2k -1

then after that I started my substitution. My qeustion was that when I did my first subsititution I got: 4(f(2k-2) * (2*2k) - 3 where the TA got 4(f(2k-2) * (2*2k) - 22 + 1


I mean naturally - 22 + 1 = -3 but can you do that in substitution? It seems like you are forcing the problem.

Also, you are right that if "letting k be a natural number will not give all values of n". The reason, I believe, that we are letting that happen is because this is a merge sort recursion (sorry again, did not realize that I post in my first post) and that you what any size list that is going into merge sort to be divide fairly even. I do not know why, but professor could have but the floor symbol or ceiling symbol on the n/2 and that would do it.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 14 ·
Replies
14
Views
2K
Replies
7
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
8
Views
2K