Space and time analysis of Insertion Sorting-2 | Analyzing an algorithm |Data Structure & Algorithms

  Рет қаралды 68,282

GATE Applied Course

GATE Applied Course

Күн бұрын

Пікірлер: 67
@pragyan152
@pragyan152 4 жыл бұрын
what a explanation!!!!! I have gone through many no of lectures and book this one is simply amazing
@rajnandinipatel81
@rajnandinipatel81 Жыл бұрын
hats off to your pedagogy. literally understood every segment of the code.
@karanamunjani8451
@karanamunjani8451 4 жыл бұрын
WOWWW!! It is "the" best explanation I seen. Thank You so much!!!
@GATEAppliedCourse
@GATEAppliedCourse 4 жыл бұрын
Glad it was helpful!
@SmilesOnly101
@SmilesOnly101 Жыл бұрын
this video and part 1 of this video togeather are the best possible explanation in a very detailed and relaxed manner. I am simply too amazed and grateful to find such an amazing lecture in this. I saw all this written in my notes and was not able to understand it myself. than you sir .
@Zleurstars
@Zleurstars 9 ай бұрын
indian teachers are so intuitive and know what the students struggle with absolutely amazing!!
@dishithagurram4154
@dishithagurram4154 3 жыл бұрын
This way of explanation is just amazing!
@blue-go4gr
@blue-go4gr 3 жыл бұрын
GOD BLESS YOU ..... I can not express enough how much this vid helped me .... I was this close 👌 to cry ;-;
@GATEAppliedCourse
@GATEAppliedCourse 3 жыл бұрын
Thank you.
@rajeshrajendran5512
@rajeshrajendran5512 3 жыл бұрын
This is the explanation I always wanted from an Algorithm analysis point of view. Great job.
@Sam-kr5ix
@Sam-kr5ix 4 жыл бұрын
What an amazing explanation keep up the great work
@GATEAppliedCourse
@GATEAppliedCourse 4 жыл бұрын
Thanks, will do!
@TheFineDine_
@TheFineDine_ 3 ай бұрын
awsome explaianation...no one has teach this topic better than u
@kanikakhatri09
@kanikakhatri09 Жыл бұрын
OMG!!! just loved the way u explained each and every concept. LOVE LOVE LOVE
@angitd3766
@angitd3766 4 жыл бұрын
one of the best explainations ever
@nadun_li
@nadun_li Жыл бұрын
This explation really helps. Thankyou so much
@tahirbintariq8934
@tahirbintariq8934 2 жыл бұрын
Such a beautiful explanation sir!!!
@naziyabegum9163
@naziyabegum9163 8 ай бұрын
thannkkk youuu sir for this video, I was struggling with this topic and I am glad that I have found this video.
@jinhuang7258
@jinhuang7258 Жыл бұрын
So good. Thank you for sharing your knowledge and passion with us.
@daniaayad5874
@daniaayad5874 11 ай бұрын
that was a very useful video, the explanation is perfect thank you soo much
@bassmw8175
@bassmw8175 3 жыл бұрын
Excellent. You explain it very well!
@madhuram6328
@madhuram6328 3 жыл бұрын
But sir one doubt as you said the maximum number of comparison will be 1 (for j=2) for worst case . But this is not about comparison it is about no of time the while loop gets executed so the maximum number of times the for loop gets executed is 2 for (j=2)( ex a={10,9,8,7 } here n is the length therefore it is 4 and the element 9's for loop gets executed 2 time because first time the condition will be true and for the second time it becomes false and the loop gets terminated. So the minimum number is 2 not 1. and the contents or the statements inside while loop gets executed only one time). Someone correct me if I'm wrong.
@thebishalpaul
@thebishalpaul 2 жыл бұрын
Absolutely correct for which the max times while loop(not comparison) will run would be (n*(n+1)/2)-1 i.e for j=2 while count: 2 for j=3 while count 3 and so on so exclude the first number from sum of n nos.
@lmcst2821
@lmcst2821 Жыл бұрын
Thanks man. I had doubts because in Cormen's Algorithms book it said \sum_{i=2}^n t_i but I was not so clear about it.
@mrsmelaniecook
@mrsmelaniecook 2 жыл бұрын
Thank you so much. I finally got it!
@muhammadabrar9057
@muhammadabrar9057 9 ай бұрын
this man is love.... love from pakistan
@paramjeetsingh3444
@paramjeetsingh3444 3 жыл бұрын
sir I have a lot to write for the video but i think 1 word will cover it all.. THANK YOU
@ghulamahmad6688
@ghulamahmad6688 2 ай бұрын
hats off !! amazaing !!
@HafidRecords
@HafidRecords 4 жыл бұрын
Thank you. Finally I could understand!
@yashedits3466
@yashedits3466 28 күн бұрын
What is the best , worst and average case scenario in quick sort and merge sort ... explain in detail with example and time complexity
@ManojK-jl2ue
@ManojK-jl2ue 2 жыл бұрын
excellent explanation...thank you sir
@yoursgkt2927
@yoursgkt2927 3 жыл бұрын
It will be really helpfull if you can share these slides.
@gateprep8076
@gateprep8076 5 жыл бұрын
Sir I have the same doubt In worst Case the array should be reverse sorted. Please make it clear. Rest of the content is super clear. I appreciate that.
@RaniLink
@RaniLink 4 жыл бұрын
When you get to the 5th element the 4 elements prior to it have been sorted. so the array might as well been reverse sorted, then this individual worst case had happened for every number along the way up to the 5th one.
@lzmkalos
@lzmkalos 9 ай бұрын
best explication everrrrrr
@3bood_kr
@3bood_kr Жыл бұрын
Worst case is when the array is sorted in descending order
@techso605
@techso605 9 ай бұрын
I want to ask that the swapping and the decrement of i will be one less then the time while loop is executing so we should minus 1 in 6th and 7th step in worst case.
@davewebb3540
@davewebb3540 Жыл бұрын
I was with you up until the a, b bit. How did you sum it all up? Feel like I'm missing something.
@arpitbhaliya2972
@arpitbhaliya2972 4 ай бұрын
Great👍😊
@MelodyUnplugged-t
@MelodyUnplugged-t 4 жыл бұрын
Thankyou. you have explained beautifully. :)
@pruff5072
@pruff5072 3 жыл бұрын
My textbook for worst case on line 5 has a slightly different answer: c5 * ((n(n+1)/2) -1
@SVNITPhool
@SVNITPhool 3 жыл бұрын
Yes that's correct becuase in worst case j comparison not j-1 .so 2+3+.......+n=(n*(n+1)/2)-1.
@StatusKing12
@StatusKing12 2 жыл бұрын
In the book did they use for loop?
@amoodaniel
@amoodaniel 4 жыл бұрын
pls, what app did you use for the onscreen writings?
@iamnottech8918
@iamnottech8918 Жыл бұрын
Just wow
@donkeykong5616
@donkeykong5616 3 жыл бұрын
Doin gods work
@АйдарБабанов-ж4п
@АйдарБабанов-ж4п 4 жыл бұрын
I think, you made a mistake in number of comparisons for j. if j == 2, then i == 1. We make comparison and after one iteration of while loop i becomes 0. Then we make last comparison. So, max amount of comparisons starts from 2 to n. Number of swaps is correct.
@shreyanshayanger
@shreyanshayanger 4 жыл бұрын
When i becomes 0 we don't compare as the conditon "i > 0" get's violated in while loop.
@АйдарБабанов-ж4п
@АйдарБабанов-ж4п 4 жыл бұрын
@@shreyanshayanger well, if i becomes 0, we have to make one last comparison, the condition (i>0) why loop stops it's working.
@АйдарБабанов-ж4п
@АйдарБабанов-ж4п 4 жыл бұрын
@@shreyanshayanger so if j==2, amount of comparisons for i is 2.
@shreyanshayanger
@shreyanshayanger 4 жыл бұрын
@@АйдарБабанов-ж4п no brother ....the program enters in comparison phase when "i>0" if i=0 the program won't run the code in while's body hence no comparison
@shreyanshayanger
@shreyanshayanger 4 жыл бұрын
@@АйдарБабанов-ж4п when j = 2 , i=j-1 ,so only one comparison between A[i]/A[1] and A[j]/A[2]
@oitik
@oitik 2 жыл бұрын
it helped thamks
@MelodyUnplugged-t
@MelodyUnplugged-t 4 жыл бұрын
isn't the value of c1,c2...cn should remain constant otherwise there will be arbitrarily growth which we do not want??
@gavinaren8534
@gavinaren8534 4 жыл бұрын
Perfect vid
@grandparick3176
@grandparick3176 4 жыл бұрын
What will be the avg case for this? I know its the same as the worst case but can anyone show by steps.
@safwansabir7566
@safwansabir7566 9 ай бұрын
the math of time complexity is wrong is should be ((n+2)(n-1))/2 not n(n+1)/2 you can dry run the algo yourself and compare the answers with both equations yourself
@louerleseigneur4532
@louerleseigneur4532 5 жыл бұрын
Thanks sir ji
@captainabhijeeth3154
@captainabhijeeth3154 4 жыл бұрын
Sir,I did't get that how it became "an+b"
@aimenbaig6201
@aimenbaig6201 4 жыл бұрын
same
@punitpal315
@punitpal315 5 жыл бұрын
Sir here when u r explaining worst case , u taken array in which all element are sorted except element 0 . So it will not give worst case complexity. So according to me for worst case you have to take array which should be completely in descending order for worst case . Thank you
@RaniLink
@RaniLink 4 жыл бұрын
When you get to the 5th element the 4 elements prior to it have been sorted. so the array might as well been reverse sorted, then this individual worst case had happened for every number along the way up to the 5th one
@musmanmureed3728
@musmanmureed3728 3 жыл бұрын
Excellent. You explain it very well!
Andro, ELMAN, TONI, MONA - Зари (Official Music Video)
2:50
RAAVA MUSIC
Рет қаралды 2 МЛН
Counter-Strike 2 - Новый кс. Cтарый я
13:10
Marmok
Рет қаралды 2,8 МЛН
Their Boat Engine Fell Off
0:13
Newsflare
Рет қаралды 15 МЛН
Every Sorting Algorithm Explained in 120 minutes (full series)
1:57:33
Kuvina Saydaki
Рет қаралды 82 М.
Big-O Notation - For Coding Interviews
20:38
NeetCode
Рет қаралды 560 М.
Heaps, heapsort, and priority queues - Inside code
19:01
Inside code
Рет қаралды 109 М.
Pseudo Code | Merge Sort | Data Structure & Algorithm | Appliedcourse
19:07
GATE Applied Course
Рет қаралды 23 М.
Top 7 Algorithms for Coding Interviews Explained SIMPLY
21:22
Codebagel
Рет қаралды 478 М.
Why Is Merge Sort O(n * log(n))? The Really Really Long Answer.
36:50
Back To Back SWE
Рет қаралды 117 М.
Andro, ELMAN, TONI, MONA - Зари (Official Music Video)
2:50
RAAVA MUSIC
Рет қаралды 2 МЛН