Тёмный

Algorithms | Time and Space Analysis | Time complexity Analysis of iterative programs | RBR 

Ravindrababu Ravula
Подписаться 679 тыс.
Просмотров 1,1 млн
50% 1

For Course Registration Visit: ravindrababura...
. For Any Queries, You can contact RBR on LinkedIn: / ravindrababu-ravula
Telegram: t.me/ravindrab...
Instagram: / ravindrababu_ravula_rbr
- For Algorithms Full Playlist: • Algorithms - GATE Comp... If you're considering studying abroad, don't forget to explore 'Games of Visas,' my dedicated consultancy service and RU-vid channel designed to streamline the process of studying abroad.
For Study Abroad, contact "Game of Visas" at 9494555454

Опубликовано:

 

29 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 666   
@ravindrababu_ravula
@ravindrababu_ravula Год назад
Get 7 Days free trial offer on Plus subscription:- unacademy.onelink.me/k7y7/f3r7fmbs
@Cheekuz_jeevan
@Cheekuz_jeevan 3 года назад
i just wanna say THANKYOU SO MUCH....... GOD BLESS YOU ......
@rahul19071993
@rahul19071993 8 лет назад
I have 19 % attendance at college. I have 90% attendance at your channel. :)
@danialjanboura8427
@danialjanboura8427 8 лет назад
+Rahul CarLos yeah that explains the 119% :P
@rahul19071993
@rahul19071993 8 лет назад
Lol :D There r times when i attend both college and this channel..
@fotismathioudakis4697
@fotismathioudakis4697 8 лет назад
+Danial Janboura You must have the same habits, when the correct answer is 109% and not 119%
@bilalshanebond
@bilalshanebond 7 лет назад
HAAHAHAHAHAHAHAHAHA sucha a nice conversation i am very careful here not to make mistake
@littlecute9770
@littlecute9770 7 лет назад
Hazrat Bilal .... such a not sucha a
@rajathans9
@rajathans9 10 лет назад
Brilliant explanations. Keep up the good work! (y)
@rimikhandelwal4664
@rimikhandelwal4664 4 года назад
Thank you so much sir..Our college teacher were also taken questions from your videos and I was not able to understand in their class..but by chance I get your videos on youtube and now I am able to clear all my doubts......
@Fahad-dh7wg
@Fahad-dh7wg 8 лет назад
Thanks for your videos. A lot of my professors in my CS classes use lazy or voodoo math, so it doesn't make sense to me when they do analysis or how they reach their conclusions.
@ajaypanthagani5959
@ajaypanthagani5959 5 лет назад
at 13:07 "j" loop also depends on "i" i.e. taken n=2; for i=1 j runs for 1 time, i=2 j runs 2 times therefore j runs for 1+2 = 3 times in total; for every j , k runs 100 times if n=2 the statement is print 3*100 = 300 times; the total analysis goes wrong.
@prasadtambe2796
@prasadtambe2796 7 лет назад
Nice lecture..now my all doubts get cleared.keep it up and thank you sir..
@zeeshantasleem9165
@zeeshantasleem9165 5 лет назад
You are amazing at teaching Boy !! Keep it up... I Had nothing in my mind to understand, but you almost won my compliments... Hats Off to you.. Love From Pakistan
@muhammadahmad96
@muhammadahmad96 8 лет назад
Helped alot...Thank you so much, Sir!
@muhammadharoon8290
@muhammadharoon8290 8 лет назад
Hahahaha :p
@aashishaxis5108
@aashishaxis5108 6 лет назад
For people trying to figure out how (k*k+k)/2
@nishanthadda8824
@nishanthadda8824 3 года назад
You wrote it opposite.
@drinkeatandthink
@drinkeatandthink 6 лет назад
At 21:10 .. shouldn't it be 2^k >= n because if n is odd then 2^k will be greater then n .. so what will be our complexity then ..and if it will be same like logn then please give me the reason 😬
@hassannazar4178
@hassannazar4178 10 лет назад
for (int i = 1; i < N; i = i++) for (int j = i; j < N; j++) total++; How will we reason for this? please help
@giorgidvalishvili4439
@giorgidvalishvili4439 9 лет назад
O(n to 2)
@Yamassurgeon
@Yamassurgeon 9 лет назад
I assume that you are asking how n^2 is coming. For each i in 0
@abeerqamer9017
@abeerqamer9017 7 лет назад
In the 1st iteration i will be 1 and J will be 1 too and for each value of i J will run exactly N times so the time complexity will be O(N^2)
@ashishnegi3848
@ashishnegi3848 7 лет назад
no it can't be evrytime as for the next loop j will run n-2 times since j=i;
@nileshatkari7268
@nileshatkari7268 8 лет назад
(k^2 +k)/2 >n hence k=underroot(n) how can you explain ?
@pikeshmn
@pikeshmn 6 лет назад
at 36:42, will there be any dependency on 2^(2^k)? The inner while loop will for any large number run for log(logN) times, correct?
@MegaPerformances
@MegaPerformances 6 лет назад
Sir...how do we find the worst case ..best case of a randon algorithm????
@yaseenrajpoot2366
@yaseenrajpoot2366 5 лет назад
just classyyy
@omargonalfa
@omargonalfa 8 лет назад
Thank you sir !!!!
@poojakumari-shortcut
@poojakumari-shortcut 7 лет назад
How (K^2+k)/2 >n k= root n
@moizsohail8193
@moizsohail8193 6 лет назад
Don't know it myself. But I think it has something to do with dominant k. Since k^2 is dominant to k, you remove the excess. I saw this in one of the hacker-ranks video about BIG O notation.
@AkashKumarSahu
@AkashKumarSahu 6 лет назад
k^2 + k > n/2 for tightest upper bound k^2 >n k>sqrt(n) k=O(sqrt(n))
@robelseyoum1583
@robelseyoum1583 6 лет назад
Thanks
@ram-tv5701
@ram-tv5701 6 лет назад
If K>sqrt(n) Doesn't that mean that K is the upper bound of sqrt(n)? sqrt(n) = O(k)...
@shreyashdeogade8869
@shreyashdeogade8869 5 лет назад
@@ram-tv5701 No. K= O(√n) means that K0 and n>=n0, for some n0>=1
@tirtotheha88
@tirtotheha88 7 лет назад
thankyou sir!
@henoksetegne2710
@henoksetegne2710 3 года назад
Hi, may i know the time complexity for for(long count=0,i=N; i>0; i--) { long j=i; while(j>0){ count +=j; j/=2; thanks in advance } }
@sight-explore
@sight-explore 2 года назад
After analyzing your code, your code can be simplified into: 1) `count` can be safely remove (No dependency) 2) Converting the inner while loop into for loop(For sake of understanding) count = 0 for(i=N; i>0; i- -): for(j=i; j>0; j/=2): count += j Dry Run: ======= When i=N, j executes log2(N+1) times ([26:50] but upto j>=1) When i=N-k, j executes log2(N-k+1) times When i=1, j executes log2(1+1) times Execution ======= = log2(N+1) + log2(N) + ... + log2(N-k+1) + ... + log2(2) = log2[ (N+1) . (N) . ... (N-k+1) ... . 2] = log2[ (N+1)! ] = log2(N!) Time Complexity ======== As we know that O(N!) = O(N^N) Therefore, = log2(N!) = O ( log2(N^N) ) = O (N. Log2(N)) Hence the Time complexity will be O(N.logk(N)) where k = 2 For eg. if N = 4, then in worst case the loop will execute 8 times if N = 16, then in worst case the loop will execute 64 times and so on Verification ======= loop = 0 count = 0 for(i=N; i>0; i- -): for(j=i; j>0; j/=k): count += j loop++ The value of loop will always be less than O(N.logk(N))
@worldcitizen7890
@worldcitizen7890 4 года назад
For all those comparing him from your professor: He is an IISc alumni !!!!!!!!!
@kimjongun2228
@kimjongun2228 4 года назад
omg its a place where suda murthy came from it is a place where alumini are studious not like my college who has actors , cricketers and shit
@__________.20yearsago22
@__________.20yearsago22 3 года назад
Do you know which batch?
@AvinashSingh-bk8kg
@AvinashSingh-bk8kg 5 лет назад
The Time Complexity of Executing your explainations in my memory is : O(1) :)
@shivambabbar1405
@shivambabbar1405 5 лет назад
Google wants to know your location
@yoowon-hye9270
@yoowon-hye9270 4 года назад
While the typical college professor takes about O(n^n)
@ArpitKharbandaIsAwesome
@ArpitKharbandaIsAwesome 4 года назад
@@yoowon-hye9270 More like (n factorial)
@kaustubh_ramteke_07
@kaustubh_ramteke_07 2 года назад
@@yoowon-hye9270 infinity, you can say.
@siddarthtyagi3761
@siddarthtyagi3761 4 года назад
The question at 28:20 came in GATE 2017, this video was posted in 2014. Mind=Blown! Genius.
@baska-
@baska- 9 лет назад
You're a better teacher than my College teacher, who has a doctorate and thinks he's the big sh!t. Thank you for the lesson.
@miranadja5113
@miranadja5113 9 лет назад
+BaSkA I 100% agree with you the same happened to me lol
@baska-
@baska- 9 лет назад
sad life bro
@miranadja5113
@miranadja5113 9 лет назад
+BaSkA unfortunately yeap by the way sis not bro lol
@baska-
@baska- 9 лет назад
Mira Nadja sorry sis, send show some pics tho.
@miranadja5113
@miranadja5113 9 лет назад
+BaSkA no need to apologize bro.. I thought from my name is clear... obviously is not known in your country lol
@studyonline3236
@studyonline3236 5 лет назад
You've explained COMPLEXITY with so much SIMPLICITY
@kirtipandya4618
@kirtipandya4618 4 года назад
I am studying in germany. This lecture series is really awesome. Way better than our prof. Thank you so much. 🙏🏽
@chloekimball536
@chloekimball536 6 лет назад
God bless you for saving me from a bad professor!
@sumitnaiyaa
@sumitnaiyaa 3 года назад
From which university
@shatakshisharma4084
@shatakshisharma4084 4 года назад
15:25 ,you solved for last loop i.e,100+200+300........... what about other two loops, won't they contribute to complexity?
@anushaboina6237
@anushaboina6237 4 года назад
Same doubt! Anybody clarify?
@returntosacredhome3594
@returntosacredhome3594 4 года назад
@@anushaboina6237 he multiplied j value to k at every iteration i.e 1*100,2*100,3*100........n*100 and for first loop executive only 1 time for each iteration ,so no need to bother about multiple of 1 i.e 1*1*100,1*2*100,...... 1*n*100
@tonysanders7395
@tonysanders7395 4 года назад
same question. Im thinking for that one he didn't do overall complexity but for each for loop?
@syedmuhammadmusab554
@syedmuhammadmusab554 8 лет назад
you have explained COMPLEXITY very clearly...thanks :)
@andreysantos6660
@andreysantos6660 5 лет назад
What a great lesson, thanks for doing this awesome job for free...greetings from Brazil!
@sumitnaiyaa
@sumitnaiyaa 3 года назад
Good luck from India
@rockylovesall
@rockylovesall 9 лет назад
Thank you so much!!, I have seen many videos but the way you have covered various cases to compute time complexity is awesome.. and +1 for the simple explanation.
@Leo-op5qo
@Leo-op5qo 7 лет назад
I like the way you teach by giving so many examples because a big theory can be found in the books but the main thing is to understand the concept which can only be done by examples. Keep it up man.
@omerergun7666
@omerergun7666 6 лет назад
The best algorithm analysis lesson that I ever seen. Many examples and great explanations. Thank you.
@kartikeyjajoo8499
@kartikeyjajoo8499 5 лет назад
Great lectures, thanks man! Can you please tell me time complexity of following code: int count = 0; for (int i = N; i > 0; i /= 2) { for (int j = 0; j < i; j++) { count += 1; } }
@lipsbreeze
@lipsbreeze 8 лет назад
can you please do a completeeeee java course. i've purchased courses on udemy for various programming languages but nothing compares to your teaching skills. I was hoping you could do a full java development course. I'd be so interested in purchasing it! i'm pretty sure it'll be extremely popular. please please consider doing it soon. i'm struggling!
@sumanthmw20
@sumanthmw20 6 лет назад
I might be a bit late, but this is his website: ravindrababuravula.com/
@kunalpatidar1675
@kunalpatidar1675 5 лет назад
bro follow durga sir
@komaljoshi4740
@komaljoshi4740 6 лет назад
I'm in love with your teaching way and the things you explained so well!😍
@RahulSiyanwal
@RahulSiyanwal 5 лет назад
@31:28 the order should be n^2(log n), right?
@israelmekonen9398
@israelmekonen9398 4 года назад
What an interesting explanation! it makes me to know more about Time complexity,thanks a lot!!!
@ssharma5127
@ssharma5127 5 лет назад
In 2nd question which has come in gate, the loop goes like this when 1st time condition check is there i=1 and s=1, when 1 st time loop execution done then 2nd time loop check is there so i=2,s=3, similarly say loop executives k times so value of i= k and s=k(k+1)/2 when loop has executed k-1 times(it value before kth execution) then after kth execution i=k+1 and s=k+1(k+2)/2 then this value will hold the inequality
@mohd_taufeek
@mohd_taufeek 4 года назад
May you tell me why you multiple 100 *1, 2,3...n whenever k is not depends on i. 13.30
@alokesh985
@alokesh985 4 года назад
I read somewhere on stackoverflow that inside big-Oh or any other aysmptotic notation, we never consider constants and O(log(base2)n) is equivalent to O(log(base5)n) or any base. So we can basically write O(log(n)), without mentioning the base.
@MCAAARULMishra
@MCAAARULMishra 2 года назад
Yeah because [log(base a) n] is typically [log n / log a] so log a here being a constant can be ignored...hence we can write O(log(n)), without mentioning the base
@akanshamundel7498
@akanshamundel7498 4 года назад
I hve doubt in ex of itratable loop how( k2+k) /2 becomes O(root n)??
@foodie_traveller_motorhead
@foodie_traveller_motorhead 4 года назад
Can someone explain this
@akanshamundel7498
@akanshamundel7498 4 года назад
@@foodie_traveller_motorhead mee too wants this !!
@VarunGupta-je2pq
@VarunGupta-je2pq 4 года назад
I guess (n)(loglogn)^2 coz we have, n k(k+1)/2, k=loglogn 36:40
@dineshbasnet5412
@dineshbasnet5412 7 лет назад
Can someone please explain how (1 + 1/2 + 1/3 + 1/4 + 1/5 + ....... + 1/n) = log n? Ravindra uses that equivalency at 31:10.
@princesubhi828
@princesubhi828 7 лет назад
the log n definition is like this
@satadhi
@satadhi 7 лет назад
i know its late but i dont think so the expansion of log is this !
@pokerface550
@pokerface550 7 лет назад
I suppose he meant natural logarithm (ln n)
@shubhamjain4747
@shubhamjain4747 7 лет назад
stackoverflow.com/questions/25905118/finding-big-o-of-the-harmonic-series. Check this out
@hameersingh7545
@hameersingh7545 7 лет назад
refer to 12 standard mathematics book
@DeepakKumar-sbiso
@DeepakKumar-sbiso 8 лет назад
Hello ravi, Thank you so much for all the excellent videos . I have one doubt in case of dependent loops , first you are unrolling the loop and then finding how many times that Printf() statement will execute ex. A() { int i,j,k,n; for(i=1;i
@yogid3688
@yogid3688 2 года назад
Same question arises to me …. If you got the answer please reply here. Thanks
@kritisaxena1098
@kritisaxena1098 8 лет назад
sir, u have retained the constant( log 2) in two consecutive examples beginning from 22:16.....but have omitted (log2) in the last example......is dat a mistake??
@DASARITUTS
@DASARITUTS 6 лет назад
awesome sir, you turned me into a tiger from the cat in Algorithms.
@ryanchand252
@ryanchand252 7 лет назад
This is the life saver playlist😍! I can pay for this course too.
@abubakarahmed7482
@abubakarahmed7482 6 лет назад
This is gold Pure GOLD
@BhooshanSane
@BhooshanSane 8 лет назад
If you think it was rude then I am sorry. But my intention was not to criticise. I like this video and got confuse between (2^2)^3 and 2^(2^3). I just ask for clarification. Because missing bracket is confusing and gives different.
@nagasivakrishna5660
@nagasivakrishna5660 Год назад
great master , thank you very much
@faizanahmed9304
@faizanahmed9304 2 года назад
brilliant explanation sir
@GautamKabiraj96
@GautamKabiraj96 8 лет назад
You sir, are a freaking master!! Love the way you explain. Simpler, cleaner, easier. Subscribed++;
@sandeepvy1347
@sandeepvy1347 5 лет назад
Now I have to go back to learn mathematical induction 😬😭
@RahulSingh-uu7fy
@RahulSingh-uu7fy 3 года назад
Great explanation sir. Finally understood this complex complexity. May god bless you!
@sojanmathew5875
@sojanmathew5875 4 года назад
Thank you Ravi for simple explanation. Doubt on GATE-1991 question analysis (at time 9:00 in video ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-FEnwM-iDb2g.html). Conclusion of problem is, loop will be executed sqrt(n) times. Let's try 2 values of n (n=50 and n=10,000). For n=50, as per whiteboard, loop will be executed 10 times (i=10, s= 47), but as per analysis, loop will be executed "sqrt(50)" === 7.x times. For n=10000, as per whiteboard loop will be executed 140 times (i=140, s= 9870), but as per analysis loop will be executed sqrt(10000)=100 times. As n increases, the difference between "i value" and sqrt(n) increases. Am I missing something?
@user-ns4mc1ps1h
@user-ns4mc1ps1h 9 лет назад
for the example starting from 11:00 to 15:30, shouldn't the time complexity be O(n^3) ?? the code is - for ( int i=0; i
@GeethikaAmbarish
@GeethikaAmbarish 8 лет назад
he calculated every iteration i separately and then added all of the iterations. the method you considered calculated the time complexity for all the steps till i.So,you should not add them in the end.Just calculate when i=n which is order of n^2.
@malikforever3182
@malikforever3182 7 лет назад
for better understanding the inner most for loop can be considered as a constant, like u can remove that inner for loop with 100 times printf(ravi) written now we will end up with only 2 loops and their is no way to achieve n^3 with only two loops.
@soumengorain2891
@soumengorain2891 7 лет назад
karthik prasad you r getting confused between the no. of time the program is getting executed and the no. Of times the printf statement is getting executed.. Yes the no. of times the entire program is being executed is of order n^3.. Bt the p. f statement, the no. Of times the 2 inner loop getting executed counts...
@aqumus
@aqumus 6 лет назад
"" if "i" runs 2 times, "j" runs 2*2 times(2 times for each time of i i.e 2*2) and k runs 2*2*100 times, if "i" runs 3times, "j" runs 3*3 times and k runs 3*3*100 times. "" this would be true only when it would be for ( int i=0; i
@abnormal7273
@abnormal7273 8 лет назад
Hello Ravindrababu What is time complexity of fun()? int fun(int n){ int count = 0; for (int i = n; i > 0; i /= 2) for (int j = 0; j < i; j++) count += 1; return count;} To me the time complexity is O(nLogn). Is it correct ?
@aaliasarfraz647
@aaliasarfraz647 7 лет назад
hloo sir can u plz tell me time complexity of this code step by step?? num=0; for(i=N; i>0; i--) { if(i>j) { num=num+1; } else { for(K=N ; K>0 ; k++) num=num+1; } }
@kailashmedavarapu9859
@kailashmedavarapu9859 4 года назад
Very Thanks Bro. Now, I got courageness for explaining it to my friends... Exam fear = 0, after watching ur videos
@vineetverma6645
@vineetverma6645 4 года назад
"Now I have become courageous..."
@javishu-javatutorial6047
@javishu-javatutorial6047 4 года назад
guys if anyone can clear this doubt please reply. the concept which he is explaining @29.00, he said that j increment as j+i , so if i=2 then j+2 should be calculated right , but why its considered as n/i times ?
@zahidshoumik8967
@zahidshoumik8967 4 года назад
That was absolutely amazing.. no one solves that many problems..
@anshumanpal9230
@anshumanpal9230 4 года назад
Cleared the concepts very well, and the questions were awesome!!!
@vivianuzor8835
@vivianuzor8835 6 лет назад
I really appreciate your hard work and effort, but I am finding it hard understanding you because your accent is so strong. Good jobs anyway
@okeuwechue9238
@okeuwechue9238 6 лет назад
Vivian, LoL.
@annvarghese4728
@annvarghese4728 8 лет назад
how to calculate time complexity with the help of tables the columns in such are 1.steps per execution 2.frequency 3.total number of steps
@tubegallery9778
@tubegallery9778 5 лет назад
malayali?
@konstantinrebrov675
@konstantinrebrov675 6 лет назад
27:20 If the number is not a power of 2, why do we have floor(log2(n)) iterations? It is because when we are doing integer division, if the number has a fractional part like x.5 we take the floor of that. In other words every time we do an integer division, we take the floor, so the overall result would be floor as well. What if when we do the integer division we would take the ceil instead of taking the floor? What if we would round up the result of the integer division no matter what, when we have some number like x.5? Then the number of iterations of the loop would be ceil(log2(n))! Try it on paper.
@PrasannjeetSingh
@PrasannjeetSingh 7 лет назад
@9:25 how did you get to the conclusion that K is order of root n?
@shivammaheshwary2570
@shivammaheshwary2570 6 лет назад
Solve the quadratic equation in k. You get k in terms of sqrt(n).
@juhisingh6161
@juhisingh6161 6 лет назад
kaise
@shivammaheshwary2570
@shivammaheshwary2570 6 лет назад
juhi singh K^2 +k>2n K>( -1+sqrt(1+8n))/2
@AkashKumarSahu
@AkashKumarSahu 6 лет назад
k^2 + k > n/2 for tightest upper bound k^2 >n k>sqrt(n) k=O(sqrt(n))
@okeuwechue9238
@okeuwechue9238 6 лет назад
The highest power in the expression generally dominates/determines the Order. In this case the highest power of k is 2. Now, solve the inequality to express it in terms of k for the dominant term (i.e. the 2nd power). You'll end up with : k > sqrt(n)
@pphantom5037
@pphantom5037 7 месяцев назад
howd we get the part at 18:51 where n(n+1)(2n+1)/6 ? brilliant explanation tho thank you so much
@venkatasai5460
@venkatasai5460 7 лет назад
can't we say that the outer loop(for(i=1;i
@KenzalameilleureduK
@KenzalameilleureduK 4 года назад
Why did we divide by 2 the complexity in the case k(k+1)/2 ????
@suryapssk5576
@suryapssk5576 4 года назад
its a formula for sum of n natural numbers
@eddardstark7875
@eddardstark7875 6 лет назад
MY teacher totally copies your study pattern , even the same name RAVI in print statement ,LOL . YOU ARE THE G.O.A.T
@ThanhVo-hf7ei
@ThanhVo-hf7ei 6 лет назад
Your teacher so bad.hahaha
@algoandaiacademy4498
@algoandaiacademy4498 4 года назад
I have never seen such a beautiful explanation. You have a good grip on what you deliver. I also have taken your automata lectures. Those too were mind blowing
@nguyenhuongquynh6861
@nguyenhuongquynh6861 Год назад
I think the last algorithm calculation result is wrong. it is supposed to be O(2 ^2^k +1)
@PawanKumar-tu6ti
@PawanKumar-tu6ti 4 года назад
Sir, what if in 24:54 it would've been n/2 in the second loop having j as the control variable, what could've been the time complexity ...could it have been like O(n*log(3n/2)); sir please reply this... it's urgent!
@satyamrai4064
@satyamrai4064 7 лет назад
I have a doubt at the algorithm at 28:25: where first for loop is running n times and second loop is running n(1+1/2+1/3+...+1/n) times so shouldn't the number of time the loop is running be n(n(1+1/2+1/3+...+1/n)) times so it will be n^2(1+1/2+1/3+...+1/n) taking (1+1/2+1/3+...+1/n) as constant the answer should be O(n^2)
@ankitsharma8221
@ankitsharma8221 7 лет назад
1/n cannot be a constant
@alimuazzam4295
@alimuazzam4295 6 лет назад
i guess u r right @satyam but the answer should be O(n^2(log n))
@chloekimball536
@chloekimball536 6 лет назад
You explained it brilliantly. This has to be the best video on time complexity! Thank you sir.
@shalemsingh679
@shalemsingh679 4 года назад
Just wow. The Best explanation
@subrahmanyamdommeti7529
@subrahmanyamdommeti7529 3 года назад
at 28:45 why outerloop 'n' is not calculated ..i think the answer is O(n^2logn) is it right?
@sanjogtakhobragade876
@sanjogtakhobragade876 9 лет назад
at 19:54 please check: A() { for(i=1;i
@ninadkalanke8880
@ninadkalanke8880 4 года назад
Sir, I think you did the last problem wrong it should be O(n*loglogn*loglogn).
@mshingote
@mshingote 10 лет назад
what will be the time complexity of euclidean algorithm ???
@ssharma5127
@ssharma5127 5 лет назад
Sir at 23:22 lets say n=4 then i will run 3 times from i=2,3,4 as i
@sachinkamble3854
@sachinkamble3854 5 лет назад
you are right bro. but for calculating time complexity we exclude constant term. that is why he took n/2 only.
@aniketrohit7287
@aniketrohit7287 3 года назад
20:26 here this forms are GP whose last term is 2's power k-1 not 2's power k
@kumarvaibhav7203
@kumarvaibhav7203 8 лет назад
Can someone help me out with a confusion. In the of the problem discussed above ( GATE - 1991 ) around 8th minute or so...the value of s and i are taken as (s,i) = (1,1,) , (3,2) , (6,3) , (10, 4)....and so on... but looking at the algo i=1; s=1; while(s
@SitanshuNandanTheStansho
@SitanshuNandanTheStansho 8 лет назад
+Vaibhav Kumar you are missing the values initialized. before entering the loop, the values of (i,s) is (1,1). so, during the first iteration, initially, i will be incremented to 2, and then i will be added to s, so 2+1 = 3. hence, s becomes 3.
@mehagerm6615
@mehagerm6615 6 лет назад
sorry , but when we reach this result .. 100(1+2+3 ..+n) ... how do you translated to 100(n(n+1)/2) , if we substitute n for example with values 1, 2 & 3 , it gives .... 100(1(1+1)/2) = 1 , 100(2(2+1)/2) = 3, 100(3(3+1)/2) = 6 .... so it doesn't mean 100(1+2+3..+n), am i doing something wrong here ?
@ankitsharma8221
@ankitsharma8221 6 лет назад
brilliant.org/wiki/sum-of-n-n2-or-n3/
@subhashk2876
@subhashk2876 9 лет назад
in this lecture you have given an example... a() { int i; for(i=0;i
@Himanshu-vd1jm
@Himanshu-vd1jm 9 лет назад
+Subhash k start from i=1; not from i=0 as anything multiply by 0 is 0 so the value of i is not incremented.
@kiruthigakumar8557
@kiruthigakumar8557 3 года назад
can anyone help me with how k2+k/2 > n became k=O(root n)? (9:33)
@ssharma5127
@ssharma5127 5 лет назад
Please tell me the time complexity O(n) and big o of n are both different things na
@smitshah18
@smitshah18 5 лет назад
I guess it is same, As you have written O(n) only which is same to big O of n.
@dileepteja3
@dileepteja3 6 лет назад
You said at 20:38 that 2^k=n...but i think 2^k-1=n,because the for loop is executing for n-1 i,e i
@dileepteja3
@dileepteja3 6 лет назад
you said you'll contact me ...i gave my number also in the mail...please call sir ...i'm desperate to take your course ...but before that i want to clarify some doubts regarding taking the course.
@sarikadevpunje5220
@sarikadevpunje5220 8 лет назад
you made it so simple 😁. thank you . really the best .
@rishiadmin1370
@rishiadmin1370 3 года назад
Took5days to complete
@chib2008
@chib2008 7 лет назад
About the solution of problem at time 15:18, shouldn't it be (n) x (n(n+1)/2) x (100) => O(n^3) ? (i's loop executes n times, j's loop executes 1 to n times, and k's loop executes 100 times for each of the above loop iterations)
@bhargav8232
@bhargav8232 7 лет назад
j isnt 1 yo n. its 1 to i.
@saishanmukh1583
@saishanmukh1583 3 года назад
I want to be his cameraman. so that I can become the topper of all exams hehehee
@rahulj6c
@rahulj6c 3 года назад
👍👍👍👍
@miranadja5113
@miranadja5113 9 лет назад
I watched a lot of videos wich was some how confusing your way of explanation so amazing teach all the respect for you gooooooooooooooooooooo on
@wardahnadeem2368
@wardahnadeem2368 6 лет назад
can anyone please tell me what will be the complexity of for(int i=1 ; i
@grovestreet9165
@grovestreet9165 6 лет назад
i try my best but it seems difficult for me
@nilashishchakraborty3983
@nilashishchakraborty3983 10 лет назад
15:26 I didnt get this part Sir. n(n+1)/2 is the sum of all natural numbers. But You have written n^2. How did this come? Please let me know. Thanks :)
@SunOfRa
@SunOfRa 10 лет назад
n(n+1)/2 = n^2 + n / 2 = n^2 = O(n^2)
@CrazyHeartWizard
@CrazyHeartWizard 7 лет назад
Thank You sir, i didn't really ever understand this untill now.
@Nidhi-Dodiya-1014
@Nidhi-Dodiya-1014 11 месяцев назад
9:06 Since we are first calculating i++ then s, so shouldn't we add the time required for both these? i.e. k + k(k+1)/2.
@ravindrababu_ravula
@ravindrababu_ravula 11 месяцев назад
Yes
@Sk-fc3zk
@Sk-fc3zk 4 года назад
One doubt sir in the 6th example the loop is from for(i=1;i
@Sk-fc3zk
@Sk-fc3zk 4 года назад
In 19:52 time
Далее
КАК БОМЖУ ЗАРАБОТАТЬ НА ТАЧКУ
1:36:32
Understanding the Time Complexity of an Algorithm
24:59
Time complexity analysis - some general rules
8:20
Просмотров 568 тыс.