Algorithms - Solving Recurrence Relations By Substitution

  Рет қаралды 92,742

Ryan Schachte

Ryan Schachte

Күн бұрын

Пікірлер: 67
@khanhchung5207
@khanhchung5207 2 жыл бұрын
Thank you for your explanation of this technique. This is the first video about DSA that I could watch entirely without feeling boring. I hopefully you can make more videos about the techniques that are frequently used in interview problems.
@zetrox1870
@zetrox1870 4 жыл бұрын
What 5 websites, 3 other tutorial videos and my prof couldnt explain well enough for me to get, you have managed to explain perfectly clearly how to do this. Thank you.
@rohanwadhavkar5343
@rohanwadhavkar5343 5 жыл бұрын
That was incredible. You explained this much better than my professors or the TAs ever did. Subscribed!
@TheSimpleEngineer
@TheSimpleEngineer 5 жыл бұрын
Thanks!
@christianremwood4817
@christianremwood4817 4 жыл бұрын
This one video just clarified 4 weeks of confusion for me. Thank you so much!
@Amande3p25
@Amande3p25 7 жыл бұрын
You've explained this better than any other video on youtube. Finally, I understand this stuff now.. Thanks for posting this
@onesimusambaw373
@onesimusambaw373 3 жыл бұрын
am gonna see depending ur comment
@شوقالرجيعي
@شوقالرجيعي 6 жыл бұрын
THANKS i almost cried all other algorithms explanation videos sucked so bad its like they want me to fail the course (bad instructor bad videos) but im saved by you yaaaaaaaaaaay
@abdulwahedmm
@abdulwahedmm 5 жыл бұрын
tried ***,,e5tbary bkrh ..pray for me
@susantasharma
@susantasharma 5 жыл бұрын
you can also checkout this one . Just too good kzbin.info/www/bejne/hZObhIBmm99pppI
@amruthsar
@amruthsar 5 жыл бұрын
Thank you so much.. I hadn't understood this for years and this one lecture changed it..
@brianstorm597
@brianstorm597 3 жыл бұрын
Amazing presentation man. I wish my university professor was as clear as you were in the video. Kudos!
@adhwaaalanazi2552
@adhwaaalanazi2552 7 жыл бұрын
you are the BEST, you solve the biggest problem for me in the woooooooorld
@TheSimpleEngineer
@TheSimpleEngineer 7 жыл бұрын
:)
@IsaacC20
@IsaacC20 6 жыл бұрын
I found this video very helpful but there needs to be clarification at @12:52. The linear term, n*c, didn't fall from the sky. It comes from the 'merging' operation of elements from two sorted containers (each containing a subset of elements sorted from a more recent recursive call). The merging operation (a sorting algorithm in its own right, I suppose) involves comparing 2 elements at a time, one from each container, until either or both containers are exhausted. The larger (or smaller, depending on whether you sort high-low or low-high) of the two element is inserted into another container to be used in the next recursive step. The comparison and insertion constitute n*c complexity.
@IsaacC20
@IsaacC20 6 жыл бұрын
Also worth noting: 'k' represents how many levels 'deep'/'down' you are in your recursive call.
@Tylermania66
@Tylermania66 6 жыл бұрын
you know there is a very high pitched screech in your into.
@phoenixhartmann7121
@phoenixhartmann7121 4 жыл бұрын
i noticed as well, because of the pain in my ears
@giliza
@giliza 3 жыл бұрын
I do like his tutorials but I always jump that Intro.
@riczd
@riczd 6 ай бұрын
Thanks for the explanation!!!!!!!!
@Furighteous
@Furighteous 6 жыл бұрын
You made this very easy to understand, thank you!
@JinayShah
@JinayShah 7 жыл бұрын
Thank you for making the video, you've explained it really well!
@udenithakshila2069
@udenithakshila2069 4 жыл бұрын
Great explanation. thank you
@janssenkuhn4049
@janssenkuhn4049 3 жыл бұрын
These are great videos. Too bad they don’t show up in Google results and instead I get stuff from people who are better at SEO than SE.
@DebasishOpu
@DebasishOpu 6 жыл бұрын
Great video. Thank you so much.
@millermeares6676
@millermeares6676 4 жыл бұрын
18:00. Much simpler just to say 2^k = n as you already had that instead of doing the complicated log simplifying thing
@bulbul6
@bulbul6 6 жыл бұрын
Loved the presentation. 😍 Which software do use to make such amazing stuff?
@TheSimpleEngineer
@TheSimpleEngineer 6 жыл бұрын
Thanks! I used a Wacom Intuous tablet for drawing, Camtasia for editing, Adobe Audition for the audio and After effects for the intro.
@rajdevlive
@rajdevlive 7 жыл бұрын
Exactly what I was looking for. :-) Thanks.
@malinayani
@malinayani 6 жыл бұрын
Category comedy, Nice :P
@jamesbones1668
@jamesbones1668 5 жыл бұрын
wow- that did it for me!
@Joemakatozi1776
@Joemakatozi1776 7 жыл бұрын
Great video. Thanks.
@fleal
@fleal 3 жыл бұрын
In case of recurrences like T(n) = T(2n/3) + T(n/3), this method doesn’t work. What kind of methods could we then use?
@icosmini
@icosmini 6 жыл бұрын
The time complexity of the first algorithm is NOT 2^N. It is N: to obtain the tenth Fibonacci number you just need to compute the previous nine numbers. You definitely don't need 2^10 (one million) computations.
@xXxOmarSanchezxXx
@xXxOmarSanchezxXx 6 жыл бұрын
Without memoization you're recomputing values already seen I believe.
@srijaljoshi3421
@srijaljoshi3421 5 жыл бұрын
That's correct for the iterative implementation. For a recursive implementation, however, it takes exponential time as shown in the video because of repetitive computations. You can draw a recursion tree to see how the same values are computed multiple times which is why the recursive implementation is generally very slow for large n ( n>=30)
@drwhackadoodle360
@drwhackadoodle360 4 жыл бұрын
What is going on with the substitution of the 2t(n-2)+c how do you sub and get rid of all the terms like the T and the -1?
@drwhackadoodle360
@drwhackadoodle360 4 жыл бұрын
I see now, took a minute,
@gaurav22221
@gaurav22221 7 жыл бұрын
Thank you Brother
@SmokyBigSmoke
@SmokyBigSmoke 5 жыл бұрын
THANKS man
@eXtrem1s
@eXtrem1s 5 жыл бұрын
Very nice video.....understood it all. BTW which software do you use to write?
@TheSimpleEngineer
@TheSimpleEngineer 5 жыл бұрын
Sketchbook
@Lucas-ns9hd
@Lucas-ns9hd 5 жыл бұрын
I wish any of these steps made sense to me. Why are we guessing about upper bounds all of a sudden? What the hell??
@preet9343
@preet9343 4 жыл бұрын
I think I understand the concept, but I can't for the life of me solve them. do you guys have any advice?
@zainabmostafa7998
@zainabmostafa7998 5 жыл бұрын
thanks for your excellent explanation , I have a question : I want to solve the recurrence relation T(n)=T(n−1)+O(n) for n>1, T(1)=1. what is O(n)? is O(n) equals to constant or what?
@comcrasher
@comcrasher 4 жыл бұрын
There is a convention in macro substituion that states : "a set in a formula rep an anonymous function in set " so the O (n) represents a function h(n)
@johnniegilkerson4724
@johnniegilkerson4724 6 жыл бұрын
@: in video, where did you get the 3rd C?
@hades2504
@hades2504 4 жыл бұрын
is the solution in explicit form??
@Kellworkie
@Kellworkie 6 жыл бұрын
Why add the "+C" after the "2T(n-1)" when solving the recurrence of the Fibonacci?
@Victim_Crasher
@Victim_Crasher 6 жыл бұрын
I think it's a time taken for other stuff like the addition between T(n-1) and T(n-2) on fibonacci, CMIIW
@aladdin_mck
@aladdin_mck 3 жыл бұрын
This is the same as this and the same as that and the same as this.... bro what?
@shakeelrajput5038
@shakeelrajput5038 6 жыл бұрын
Sir can you explain me what is log2(n)?
@comcrasher
@comcrasher 4 жыл бұрын
its actually log n with base 2
@dancerham
@dancerham 7 жыл бұрын
how did you get n/2^k = 1 @ 16:47?
@EbenTuff
@EbenTuff 7 жыл бұрын
He says "I want to recurse to the base case, otherwise I'll have a never-ending algorithm". With this, we want T(n/2^k) to become T(1) [[The base case]]. T(n/2^k) must become T(1). Therefore, in the base case, n/2^k = 1
@dancerham
@dancerham 7 жыл бұрын
OH! Thankyou! :D
@amirtv106
@amirtv106 7 жыл бұрын
Considering integer division, n/2^k will reach 1 eventually.
@LordShish
@LordShish 6 жыл бұрын
08:04 wouldnt that 2^0 be 2^1?
@toriacasta9308
@toriacasta9308 7 жыл бұрын
I need help on solving this recurrence relation. I've been stuck on it. T(1)=5, T(2)=11, T(n)=5T(n-1)- 6T(n-2) PLEASE HELP
@TarunMohandas
@TarunMohandas 6 жыл бұрын
Convert it into a quadratic equation. T(n) - 5T(n-1) + 6T(n-2) = 0 (t^2) - 5t + 6 = 0 t = 2, t = 3 T(n) = A(2^n) + B(3^n) [from solution to quadratic equation] Now we use base condition T(1) = 2A + 3B = 5 T(2) = 4A + 9B = 11 Solve for A and B. A = 2, B = 1/3 T(n) = 2(2^n) + (1/3)(3^n) T(n) = 2^(n+1) + 3^(n-1)
@akshitarawat1970
@akshitarawat1970 5 жыл бұрын
U took 1 ,1 ,2 So how can it be equal to n-2 ,n-1 ,n ????
@comcrasher
@comcrasher 4 жыл бұрын
Its a series . the n represents the positional value . if you take 2 to be in nth place the 1 is in n-1th place or if you take 1 as n the 2 is in n+1 th place . Simply we are indexing them based on 'n'
@delavago5379
@delavago5379 6 жыл бұрын
this could have been clearer. sorry but this didn't help. it was nice but you run off once you get into it
@hashirkhalid2151
@hashirkhalid2151 7 жыл бұрын
i think you have done this by iteration method and not by subsitution method. Subsitution method requires to take an initial guess , which ofcourse you havent taken here
@TheSimpleEngineer
@TheSimpleEngineer 7 жыл бұрын
Hashir Khalid I believe you are referring to non homogeneous linear recurrence relations
@hashirkhalid2151
@hashirkhalid2151 7 жыл бұрын
^sorry my mistake, i got it now ! BTW thanks for the lecture. Nicely poised and easily understandable
@TheSimpleEngineer
@TheSimpleEngineer 7 жыл бұрын
Hashir Khalid My pleasure! I made another lecture on non homogenous LRR's as well if you're curious.
2.1.1 Recurrence Relation (T(n)= T(n-1) + 1) #1
13:48
Abdul Bari
Рет қаралды 1,7 МЛН
Amazing remote control#devil  #lilith #funny #shorts
00:30
Devil Lilith
Рет қаралды 16 МЛН
Walking on LEGO Be Like... #shorts #mingweirocks
00:41
mingweirocks
Рет қаралды 7 МЛН
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 3,1 МЛН
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 19 МЛН
Recurrence Relation Proof By Induction
7:42
randerson112358
Рет қаралды 76 М.
How To Solve Recurrence Relations
16:21
randerson112358
Рет қаралды 180 М.
Sliding Window Technique - Algorithmic Mental Models
36:45
Ryan Schachte
Рет қаралды 361 М.
Analysis of Recursion 1 - Factorial and the Substitution Method
18:04
Professor Painter
Рет қаралды 20 М.
Solved Recurrence - Iterative Substitution (Plug-and-chug) Method
9:08
Discrete Math - 2.4.2 Recurrence Relations
15:07
Kimberly Brehm
Рет қаралды 151 М.
Substitution method for solving recurrence
16:28
Yang Xu
Рет қаралды 5 М.
Master Method ( incl. Step-By-Step Guide and Examples ) - Analysis
16:18
Solved Recurrence Tree Method
6:30
John Bowers
Рет қаралды 468 М.
Amazing remote control#devil  #lilith #funny #shorts
00:30
Devil Lilith
Рет қаралды 16 МЛН