Hopefully Izod will sign Doug to a golf shirt sponsorship deal soon. Fresh shirts in every video.
@mahaagro77835 жыл бұрын
Doug saving programmers' lives since 2017 :)
@Maen9634 жыл бұрын
Yup 😂❤
@user-st4qv2vw7q3 жыл бұрын
Thanks Doug, this is by far the best explanation on insertion sort!
@this_rishi4 жыл бұрын
wasn't this guy in 21 Jump Street?
@pramitgautam52214 жыл бұрын
This feels like bubble sort with extra steps
@thomasbeckley9187 Жыл бұрын
i love you thank you helped me in my computing lesson
@ashkiin8493 Жыл бұрын
Ended up here after seeing "insertion sort" mentioned in the average temperatures practice exercise's instructions. Wondering why this video is not included in the courses' page as the merge, selection and bubble sort are? Just seeing this video (haven't tried figuring out how to code this yet) it seems the least intuitive of all 4, and as bad as selection sort. Is that why it got removed from the course?
@khaled-dev3 жыл бұрын
i wish he shows the code as well
@GOODBOY-vt1cf4 жыл бұрын
thank you man !
@mattkan32753 жыл бұрын
You are very professional in teaching
@tiakimx4 жыл бұрын
Could someone explain more about how he got O(n^2)?
@boneserickson4 жыл бұрын
yeah he said worst case scenario, you have to shift each of n characters, n times. so n x n = n^2
@sabrinal.57753 жыл бұрын
O looks at the worst case scenario: ie, all characters not sorted - we'll have to shift every character with every movement of the line (or the character we're looking at). If we looked at 1 character before, 1 shift (the character we just looked at) needs to be made for the 2nd character to be sorted. If there are 3 characters that are all unsorted, we will need to shift each character once in order to sort to the 3rd character. The math ends up being n^2 3 2 1 --> 1st sort ('3' is sorted) (1 * 1) 2 3 1 --> 2nd (2 and 3 shift to allow 2 and 3 to be sorted, 1 is not sorted yet) (2 chars /movements of the line * 2 shifts) 1 2 3 --> 3rd sort (1, 2, and 3 are shifted to allow all 3 characters to be shifted) (3 chars * 3 shifts)
@IMADETHISACCFORRAY4 жыл бұрын
Why don't you include pseudocode? Great visualisation apart from that.
@exnihilonihilfit63163 жыл бұрын
I guess they simply don't deal with implementation in these videos.
@TypicallyThomas2 жыл бұрын
What week does this belong to? I can't find it on the CS50 website
@davidjmalan2 жыл бұрын
Week 3, but not discussed in recent years!
@TypicallyThomas2 жыл бұрын
@@davidjmalan Any particular reason for that?
@XXXDooMXXXDoesMC4 жыл бұрын
lol
@Jake-oz3fy5 жыл бұрын
Hey :))))))))))))))))DDD?
@splodys3 жыл бұрын
Wouldn't it be quicker to create a new empty array and start building it up with the elements, instead of continuously shifting elements in the original array? My only guess as to why this would be worst, is that it might make the program heavier in memory.
@jason1596tmgmail3 жыл бұрын
So, how do you decide where to put the element at the new array? You still have to shift the existing elements inside the "new" array in order to add an element to it, which is basically the same if you only have one array.
@ValentinSharonov3 жыл бұрын
Had to double check my monitor because of the artifacts on his neck.
@bivshiyzek3 жыл бұрын
Inmate shirt? Broadcasting from the prison?
@arcadeeeee263 жыл бұрын
When I try to sort an array of numbers, the way I calculate it, it every element only gets shifted (n - 1) times. For example for list of 4, 3, 2, 1: Wouldn't each element only shift 3 positions? So 4 elements * 3 shifts each = total of 12 shifts? so n * (n - 1) shifts? But Doug says each of the n elements gets shifted n times. I don't understand how each element could shift n times? for example if 4 shifted 4 times wouldn't it go over the available number of indexes in the array?
@Walruz10003 жыл бұрын
I am confused as to why the selection sort is still n squared because for each iteration of the outer loop you will be reducing the size of the inner loop by one, and on top of this you still need to swap 2 items around on each iteration. For the insertion sort there is only one loop but its the swapping that seems to end up increasing the complexity, I wonder why this is not taken into consideration for some algorithms where they loop multiple times but also need to swap each time?
@kochikamevideos25023 жыл бұрын
i didnot understand
@Enskkc4 жыл бұрын
What is the name of the CS50 course explaining all the sort algorithms?