This course has been updated into a 4 part series! We now recommend you take the A Practical Guide to Algorithms with JavaScript course.
Transcript from the "Exercise: Bubble, Insertion, and Selection Sort" Lesson
[00:00:00]
>> Bianca Gandolfo: What we're gonna be doing is we're gonna implement all of the elementary sorting algorithms, bubble, insertion, and selection. Keep in mind that when you're testing out your code, the fact that it's coming out sorted at the end isn't necessarily a sign that you're doing it right. Because for these particular sorting algorithms, what you wanna check for is that you're doing it in the order.
[00:00:21] And the logic is the same. So you might need to put a debugger in there and walk through your code. Maybe you throw in console dot logs or whatever your style is, just to make sure that it's going in the order that you expect. Because it can be easy to think you got them all right just because it comes out sorted, when actually, the logic's a little bit off.
[00:00:42] Like maybe you're doing an insertion sort for a selection sort, or vice versa, or you're accidentally doing the same thing twice. So keep that in mind.