even you passed away you are still making value for others, you are a legend man, rest in peace
@sahilbabbar88594 жыл бұрын
He is alive. His friend Harsha is sadly dead. RIP
@ShawnDypxz3 жыл бұрын
He is alive. His friend is the one who passed away.
@adilzamal32183 жыл бұрын
He is alive and Making impactful work in google
@ManojKumar-ek3fj3 жыл бұрын
@@adilzamal3218 why not he uploading videos now??
@vigneshsenthil79803 жыл бұрын
@@ManojKumar-ek3fj one of the co-founders died his name is Harsha and he was one of the top competetive programmers in India at that time.
@IAmNigHtMaReTR5 жыл бұрын
You're the REAL mvp. totally saved my Algorithms course.
@taylor-bn8ll3 жыл бұрын
ive been completely lost in this data structures and algorithms class for over a month and this video just cleared up weeks of confusion. thank you!
@OneLordeAnimeClips2 жыл бұрын
The first two minutes of this video are already so insanely perfect in terms of explaining I cannot thank you enough. Instantly subscribed.
@samarthmohanty67553 жыл бұрын
that was the best and easiest way one can learn. I m fascinated by how easily u r able to create the logic in ur head and implement it. The flow of logic u have is really unique and thanks for sharing the knowledge with us as it is really easy to understand from ur videos. An upgrad faculty of IIIT B has been teaching it with very bad pronunciation and logics and i have been trying to understand this simple calculation from his video since an hour but here only after a single view I am able to understand the approach that i need to make for such calculations. Thanks a lot and may you rest in peace.
@shado548211 жыл бұрын
I was rather lost on my homework. Within the first 3 minutes of this video everything made sense. Thank you so much!
@mycodeschool11 жыл бұрын
Hi Amar, If you see, if (n == 0) statement will always be executed.. .. return may not be executed always. That's why adding up 1 unit for the if condition. :)
@kedarpednekar95824 жыл бұрын
Man where are you !!
@mayankbisht29164 жыл бұрын
@@kedarpednekar9582 he is not with us anymore, RIP
@kedarpednekar95824 жыл бұрын
@@mayankbisht2916 oh 😶
@amritaanshnarain75243 жыл бұрын
@Vivek Sharma It is dead now, last video was uploaded 4 yrs. ago.
@sethubalaji91414 жыл бұрын
I was searching for this simple stuff for 3 days. Thank you
@sase10174 жыл бұрын
Thank you for your legacy, the world will miss you
@Shikschauhan3 жыл бұрын
Your tutorials are like treasures for learners.. don't know why you stopped making tuts... but please make tutorial series on system design
@chandragirivishnuvardhan76542 жыл бұрын
Look at first comment bro
@vortyx0909 жыл бұрын
man, why this video isnt in the compilation of the time analysis? btw...the important thing I wanted to say is GJ! TY VERY MUCH!!! you are very clear and I understand all that tstuff ;D ty
@AmarNathami190611 жыл бұрын
Hi, As per your previous tutorial, you mentioned like whenever there exist and conditional statement we should take up the worst case scenario and we should not add up the time complexities of both conditions because its either-or right. So in that case the above complexity should be calculated as T(n) = T(n-1) + 2 // 2 is constant time in worst case scenario T(n) = T(n-2) + 4 (i.e) T(n-k) + 2k when n-k =0, k=n => T(n)= T(0)+2n = 2n => O(n)
@basavarajrajur77204 жыл бұрын
Yes, you are right bro...I had same thought.
@swapanjain8929 жыл бұрын
T(0) should be 2 not 1 because in the previous videos,it was told to consider the return operation as 1 unit too.
@swapanjain8929 жыл бұрын
SWAPAN JAIN The answer doesnt change,but still..
@AkshayKumar-dz5ts8 жыл бұрын
that was for a model machine you can have your own model machine which may take 2 units per operation or anything as long as its a constant
@NeelSandellISAWESOME4 жыл бұрын
Interesting point.
@sindhiyar4 жыл бұрын
your videos are the G.O.A.T
@gouravm49863 жыл бұрын
RIP sir humblefool. thank you for your amazing contribution
@spobob889 жыл бұрын
Thank you!!!!! Ugh I needed this exact explanation about space complexity..!!!!
@chiengdorkcy48513 жыл бұрын
it look like old video, but very interesting, uploaded when l was in class 4 and now watching it in third year university degree level, how interesting this video is wow, keep it up bro
@TheGokhansimsek359 жыл бұрын
Excellent explanation and teaching methods.. thanks a million..
@chrisauret37859 жыл бұрын
Why can T(n-1)+3 be written as T(n-2)+6 ... and eventually T(n-k)+3k?
@chrisauret37859 жыл бұрын
For anyone else wondering this is just badly written index notation. The (n-1)+3, (n-2)+6.. (n-k)+3k are the index positions. It is not T multiplied by (n-1)+3 etc
@AhmedThaking9 жыл бұрын
+Chris Auret thank you for your link! This Guy is an idiot not explaining
@AnkitaSharmaHoran9 жыл бұрын
+Chris Auret Replace n by (n-1) in T(n) T(n-1)=T(n-2)+3 Now put this in T(n) T(n)=(T(n-2)+3)+3=T(n-2)+6
@pixel85477 жыл бұрын
The guy assumes that you understand recursion.
@soumyadeepmukhopadhyay4757 жыл бұрын
Thanks.
@himanshunahak51054 жыл бұрын
i learnt this in 10 minutes as compared 120 minutes of my teacher trying to teach me
@ayeshachaudhury75044 жыл бұрын
So true 😂
@anubhavsingh90493 жыл бұрын
True brother
@swagatzeher3 жыл бұрын
Nicely explained, Thank you.
@aashish15029 жыл бұрын
answer would change if we consider return operation as 1 and the exp=t(n)+4 also t(0)=2; so ans should be 4n+2
@vivekupadhyay66634 жыл бұрын
An expression for T(n) can also be found using unilateral Z transform in case the equation becomes complex.
@NeelSandellISAWESOME4 жыл бұрын
Can you elaborate?
@DharokWretched9 жыл бұрын
Excellent explanation! Also, this uses O(1) Auxillary Space right?
@kavirajpandey88263 жыл бұрын
Theta n
@roohuop4 жыл бұрын
can you make a video on fact(n) { for i=1 to n fact=fact*i; return fact; } how many steps are there? time complexity?
@himanshukesarwani74467 жыл бұрын
Sir in this video you are taking T(n)=T(n-k)+3k but According to the first equation T(n)=T(n-1)+3 the last equation must be T(n-(k-1))=T(n-k)+3k in the factorial recursion example
@AmarNathami190611 жыл бұрын
Got it.. Thanx for the clarification.. It's helpful.. Wonderful effort.. Keep going..
@gowthams60935 жыл бұрын
How did you clarify it ?
@RicsDev10 ай бұрын
very good video thanks mister !
@ahmedzak747510 жыл бұрын
Plz, can you explain how use log to compute complexity time for any example !!
@NeelSandellISAWESOME4 жыл бұрын
Log basically just means if you double the size of the input, you only need one marginal time input to account for that increase in size.
@ZerOv073 жыл бұрын
He did a video about this. Here's the link to it: kzbin.info/www/bejne/hnfHZqZml62ad7M
@samsons8279 Жыл бұрын
What if , we had more than 1 line of code within the if block ? Will it still be 1 unit of computation for the if block (comparison) ?!
@AmarNathami190611 жыл бұрын
In that video, you directly took O(n2) regardless of if statement execution.. So little confused. So even in that case if condition will be checked but not always if will be executed.. So it would be like T(n)= O(n2) +1 // 1 for checking if condition.. (i.e) T(n)= O(n2) because always we take highest order in the quadrant equation.. Am I right?
@likithasahukari4576 жыл бұрын
Why are you not considering return statement as one unit.....
@konstantinrebrov6756 жыл бұрын
The return statement is managed by the compiler. The C++ code gets compiled into assembly code. return x; is translated into assembly code as mov x, eax; So it moves the variable x into a register eax, which is the default register for return values. When you write int myNum = F(5); it gets translated into assembly code as mov eax, myNum; The calling function be default looks into the eax register to get the return value from the called function. It assumes that the called function placed the return value into the eax register. That is just how the system is set up. It is part of the GCC Calling Conventions. The compiler automatically does this for you. This is the same as setting up the stack frame of a function, saving the base pointer, moving the stack pointer, and doing other behind the scenes utility work. The compiler may also put into places some other optimizations. In general, the C++ program is portable. While it is good to know what the C++ code is compiled into, in general, it is not part of the algorithm. We do not consider things that the compiler does for the asymptotic time complexity analysis, because that is an implementation-dependent thing. The same C++ program may be compiled into different assembly code depending on: - The CPU hardware architecture (x86_64, ARM, some embedded systems) - The Operating System (Windows, Linux, Mac OS, Android) - The compiler (gcc, clang, Microsoft Compiler) - The optimization settings (-O1, -O2, -O3) We do not know these details when we are writing out the algorithm. We have to look inside the compiled assembly code to find out how the algorithm is implemented.
@rathodkirthi11084 жыл бұрын
Aren't we supposed to consider unit time for return statements too. If we consider it, T(n) will be equal to T(n-1)+5 in the first program right ??
@mustafaalisaba51683 жыл бұрын
Is the function call an operation? so it is T(n) = T(n-1) + 4 ?
@birendrakumarsingh2148 Жыл бұрын
humblefool the LEGEND
@huydang60592 жыл бұрын
Is the space complexity only depending on the function call? What if we don't have a recursion method
@stevefox74183 жыл бұрын
In evaluating the time complexity, I want to know how was it okay to generalize the constant (1) in T(n - 1). Shouldn't it stay fixed, why did we generalize it as k.
@heyyyyyworld7 жыл бұрын
Can someone explain how (n-k) becomes equal to 0?
@ArshadAli_7 жыл бұрын
Zabby nemo n-k=0 is used to make it base condition i.e T(0)
@NeelSandellISAWESOME4 жыл бұрын
I struggled with this idea too. Basically, he wants to find the amount of operations that happen when we hit our base case. Our base case is hit, when have completed k operations, so basically when n = k. when n = 1 we have done 1 operation, so when n = k we have done k operations, and when have done k operations, we have found the amount of "work" it took to reach out base case. He should have written T(0) + 3k not T(0) + 3n because he is plugging in k. Hope this helped!
@MohanaKrishnaVH6 жыл бұрын
Here we have calculated the Time Complexity to be of O(n). The iterative implementation is also of O(n) since we iterate over n elements that we need to process. However, while implementing the program for larger inputs, the recursive implementation takes more time. why is it so?
@ryeonnaderi67312 жыл бұрын
im lost at 2:17, how does it go from t(n-1) + 3 => t(n-2) + 6, then t(n-3) +9?
@mtariquegauri2 жыл бұрын
Apply the same T(n) equation to T(n-1) i.e put n-1 instead of n in the equation
@mdsaif46967 жыл бұрын
I think its wrong .... You said in the previous leson that we do not add complexities in conditional statement , rather we take the max of the conditional statements. At 2:10 although the value is correct i.e. t(n)=t(n-1)+3 but one 1 in the three comes from return statement not from the if statement.
@kid_kulafu_17273 жыл бұрын
Hello has anyone knows where I can find the other videos? I really need this. Please thank you.
@GuitaristVoyage5 жыл бұрын
Which approach is this to find the time complexity ? Substitution or recurrence relation or master method .I am usually confused in these three . @mycodeschool
@sanafatima18204 жыл бұрын
what is the best time complexity of recursive factorial?
@J0N36O8 жыл бұрын
What method did you use to calculate time complexity? Was it substitution method?
@Aryan-wv6qe8 жыл бұрын
yes bro
@lasredchris10 жыл бұрын
Just to make sure, you didn't count the return as 1 because you can only only go through one block? And it be more expensive(or worst) to go through the else block?
@PoojithJainK8 жыл бұрын
The cost of 1 unit is considered only for those statements that involve some sort of computation. The return statement does not do any computational work, it merely returns a value.
@jaimin__sagar5 жыл бұрын
how directly n-k=0 is done (why it is equal to 0).........I can't understand that.
@ivyzheng86814 жыл бұрын
Why isn’t F(0) in the memory? I don’t get it.
@shuvshaw95944 жыл бұрын
Very helpful.
@Littleangel130611 жыл бұрын
wonderful work....
@kumarabhijeet58775 жыл бұрын
in the statement T(n)=T(n-1)+3,why is it T(n-1)??
@ThePratikp11 жыл бұрын
Thanks. Great tutorial.
@god-speed035 жыл бұрын
why there is no time assigned for returning value...he did assigned a value in a previous video in time complex analysis section
@god-speed035 жыл бұрын
yeah because its inside the t(n-1)..
@rore38013 жыл бұрын
thank you so much.
@abhrajyotikirtania227510 жыл бұрын
Nice one.. thanks..
@gowthams60935 жыл бұрын
Assignment or Return function has 1 unit as said in previous videos why are we not taking that ??
@h.m.chuang02245 жыл бұрын
1 is insignificant compared to n anyway
@kollikishore356710 жыл бұрын
why didnt include the one unit time of return 1 statement ?
@lasredchris10 жыл бұрын
Don't know if it would help but see my comment near the top.
@vishaldeepak253810 жыл бұрын
nice video, well explained but the volume of the audio is very low
@asthajindal64636 жыл бұрын
Does recursion reduce time complexity and increases space complexity or its the inverse of it? Please HElp URGEnt
@akhileshswaroopxisrnnadbt36695 жыл бұрын
Time Complexity of any algorithm doesn't depend on whether you do it iteratively or recursively but yes in case of recursion space complexity increases
@vanillarootbeer10 жыл бұрын
Shouldn't you be adding one more unit time for T(0)? One for "if(n == 0)" and another one for "return 1"? I think T(n) should be 2, not 1.
@lasredchris10 жыл бұрын
Because i think it's the worst case. You can only go through one block. The if block would be 1 unit and else block is 2 units. So in the worst case calculation, he only includes the else block blocks of time.
@SaiKrishna-mo5kv8 жыл бұрын
But in any case the control goes to "if" or "else" condition and either ine of them must be satisified. So there must be an addition of 1 unit to T(n). But all of this does not matter since we neglect the constant multiplier. ex: In 3n^2,O(n) = n^2 and In 4n^2, O(n)=n^2 as well!!
@rishigupta65157 жыл бұрын
i think it will be T(n)=T(n-1)+2 bcoz there if and else there
@RaselAhmed-ix5ee4 жыл бұрын
why is T(n) = t(n-1) and not t(n)??
@hkorany125 жыл бұрын
why not T(n)+2 ?
@Nylon-xj9ml3 жыл бұрын
I hate computer engineering so much
@rezaes88482 жыл бұрын
❤️thanks
@bodhibriar96833 жыл бұрын
He is one in a million, best among many, most trusted , I almost gave up on trading then I met him through a friend, Austin is the most trusted trading expert who helped the life of my family and I ,
Is that memory table the stack in the computer's memory?
@nizki12111 жыл бұрын
Thanks!
@bhavnajain47037 жыл бұрын
I want to only know definition of complexcity and type of complexcity in toc
@AnonymousCoder7 Жыл бұрын
I'm a simple man I see Recursive fn(); I Panic !
@sssumeet2 жыл бұрын
great.
@adeeqasubahat70709 жыл бұрын
helpfull
@prabudh67133 жыл бұрын
Audio is very low
@SACHINSINGH-re5ft4 жыл бұрын
Nixooo
@abhishekwadhawan53815 жыл бұрын
bhai thoda tez bol liya kr
@khodis20023 жыл бұрын
Wiiiiiider
@r060zeeshankhan92 жыл бұрын
Sound quality is not god
@david-tracy4 жыл бұрын
How were you first able to come up with T(n-2)+6 in the first place. You did an awful job explaining that & it's a very critical piece of information. Same with the reasoning as to every detail on how you came up w/ n-k=0.... Only people who already understand it perfectly (which are the people who don't need to watch this in the first place) are the ones that will understand... Most people don't know how teach that well anyways so I honestly don't fault you too much... Just letting you know that you didn't really help me as much as you may think you did lol