Javascript Freecodecamp Algorithm #31: Implement Bubble Sort

preview_player
Показать описание
Learn how to solve freecodecamp javascript algorithms in various ways! This series is up-to-date with all ES6 and beyond javascript notations

#javascript #algorithms #freecodecamp
Рекомендации по теме
Комментарии
Автор

Thanks Justin. This is one of the best solution on the internet. Keep creating.

pitamber_singh
Автор

Bro you have killed it with this tutorial. Thank you so much man, seriously best explanation of bubble sort. Reversing the pairs, refactor was so clear to understand

alexlytle
Автор

Thank you for explanation. This was my solution before I watched the rest of the video.

function bubblesort(array) {

let length = array.length;

while(length > 0) {
for(let i = 0; i < length - 1; i++) {
if (array[i] > array[i + 1]) {
const temp = array[i];
array[i] = array[i + 1];
array[i + 1] = temp;
}
}
length -= 1;
}

return array;
}

nirm
Автор

Great video. it would be nice if you explain the complexity of the solution. it will really help someone preparing for interviews.

apoorvasa
Автор

the best explanation I've ever seen on youtube, thank you so much!

VictorSmeyukha
Автор

Thank you very much, working my way through project Odin and I was struggling to understand algorithms and other coders solutions.

davidmclean
Автор

I understood more with this 10 minutes video than I did with 2 hours at college

LePhenixGD
Автор

great content! thanks and cheers from Brazil!

chacalfmp
Автор

Yo, love this tutorial man!!!! Your logic makes so much sense to me mate! Thanks for sharing your knowledge! :)

swastikbhat
Автор

Thanks for the explanation! Great tutorial!

WatsonGT
Автор

why should we do array.length-1 and lower array.length - 1 - i, i checked with this (just array.length for i and for j ) and it worked also

DagestanShop
Автор

Suggestion - You can hide problem statement while explaining the coding part, so that we can watch coding lines clearly. Your video is helpful. Thanks. 😊

zingaalala
Автор

Great tutorial, easy to understand and very concise!!! Quick question on concept of 'pure function', at 7:45, you mentioned that a 'pure function' should NOT change the value of the parameter passed into the function. Can I ask if I can understand this statement is a special case falls into the commonly said 'Pure Functions Produce No Side Effects'? Meaning that 'change parameter value is a side effect'. If anyone could be kindly enough to clarify If my understanding is correct. Thanks!!

wendylee
Автор

Thank you sooo much omg, love this tutorial

amandarizqi
Автор

Thanks a lot justin kim!!!
Helpful Tuts.

laturchasanket
Автор

Hello Justin, love your channel, but i want to understand that [arr[j], arr[j+1]] = [arr[j+1], arr[j]], why this do the swapping ? I have never seen that way

furiajack
Автор

I'm new in using for loop in javascript. Can someone explain this code.
const temp = array[j];
array[j] = array[j+1];
array[j+1] = temp

juliairwin
Автор

not a clear explanation to be honest :/

juancaca
visit shbcf.ru