Phải chăng bạn đang cần tìm sản phẩm về bubble sort có phải không? Phải chăng bạn đang muốn tìm chủ đề Algorithms: Bubble Sort phải không? Nếu đúng như vậy thì mời bạn xem nó ngay tại đây.
NỘI DUNG BÀI VIẾT
Algorithms: Bubble Sort | Xem thông tin về laptop tại đây.
[button color=”primary” size=”medium” link=”#” icon=”” target=”false” nofollow=”false”]XEM VIDEO BÊN DƯỚI[/button]
Ngoài xem những thông tin về laptop mới cập nhật này bạn có thể xem thêm nhiều nội dung liên quan khác do soyncanvas.vn cung cấp tại đây nha.
Kiến thức liên quan đến từ khoá bubble sort.
Tìm hiểu kiến thức cơ bản về thuật toán sắp xếp bong bóng. Video này là một phần của Hướng dẫn Phỏng vấn Cracking The Coding của HackerRank với Gayle Laakmann McDowell.
Hình ảnh liên quan đếnchuyên mục Algorithms: Bubble Sort.
>> Ngoài xem chủ đề này bạn có thể xem thêm nhiều Thông tin hay khác tại đây: Xem tại đây.
Tag có liên quan đến đề tài bubble sort.
#Algorithms #Bubble #Sort.
[vid_tags].Algorithms: Bubble Sort.
bubble sort.
Với những Kiến thức về chủ đề bubble sort này sẽ mang lại kiến thức cho bạn. Rất cảm ơn bạn đã theo dõi.
A great sort if you want to get fired
Is the time complexity still O(N^2) after the optimization?
def bubble_sort(arr):
last = len(arr)-1
while last!=0:
for i in range(last):
if arr[i] > arr[i+1]:
temp = arr[i]
arr[i] = arr[i+1]
arr[i+1] = temp
last = last-1
return arr
Any pitfalls in my code?
need to get to the point in my career where i no longer have to come to this video lmao
thanks
This is beautiful explanation!
this was helpful, can you do bucket sort next
question? isnt that line that says while (!isSorted) saying while it is true do this because your saying not false?
Sorry but this logic is not correct. Let's take this input { 64, 34, 25, 12, 22, 11, 90 }. Before end of first iteration when elements are like below { 34, 25, 12, 22, 11, 64, 90 } in next for loop it will compare 64>90 will return false and isSorted = true; and it will never update it to false will not run second iteration and final result will be { 34, 25, 12, 22, 11, 64, 90 } below logic should work
private void bubbleSort(int[] arr) {
int lastUnSorted = arr.length-1;
while(lastUnSorted>=0) {
for(int i=0;i<lastUnSorted;i++) {
if(arr[i]>arr[i+1]) {
int temp = arr[i];
arr[i] = arr[i+1];
arr[i+1] = temp;
}
}
lastUnSorted–;
}
}
there is something wrong with the program,so I removed the boolean value and modified while loop as "while(lastUnsort >= 0)" followed by inner for loop, lastUnsort- – ;
Well explained thx 🙂 <3
The while(!sorted) is good if the array is already sorted. But for some beginners, this maybe some what confusing. Just for someone is not 100% getting the explanation I have written the following, for these two loops, it is more appearing why time complexity for Bubble sort is O(N^2)
public static void bubblesort(int[] array){
for(int i=0; i < array.length -1; i++) {
for (int j = 0; j < array.length – 1 -i; j++) {
if (array[j] > array[j + 1]) {
swap(array, j, j+1);
}
}
}
}
She's good that last optimization she made though, nice
Wow thank you!
nice video
# Paras Singh
How do i print this in the console?
what is this isSorted magic!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!THIS CODE DOESN'T WORK!!!!!!!!!!!!!!!!!
array[i] > array[i++]; value of "i" is same both sides, hence this always fails..
There is like four different languages of books behind you. I feel overwhelmed for the wrong reasons. 😮
Great video!
You're very attractive!
Thumbs up from Georgia Tech!
I remember this from high school — still a great presentation on the topic.
Personally, I'm tired of the pretense that employers aren't that concerned with language knowledge but are deeply concerned with algorithms and problem-solving. The more experience I get with looking for real jobs the more I find its the opposite — they don't care if you could ace a college algorithms test, nor do they care if you are skilled at developing your own algorithms and systems. No, they want someone already experience in some specific domain of programming and with expertise on specific libraries / frameworks / technologies; they want "spring and hibernate" or "Django, along with SQL, HTML, CSS, and JavaScript." They may also ask for a bunch of other things that aren't important to them, but toward the top you see something like this that is non-negotiable. Funny thing is, a talent dev who has good problem solving and self-teaching skills could learn what they need, but they don't care. All the videos on YouTube pushing algorithms, data structures, design patterns, "problem-solving," etc., are red herrings luring aspiring professional away from what they really need to learn to get that first job and make real progress toward starting a career. If you've bothered to read all this consider it your reality check for the day.
Perhaps (?) it's different for tech giants in areas with large tech industries, lots of local talent, and large teams capable of mentoring new employees — but the vast majority of business seeking devs are not like this at all.
When you "swap" an array, isnt it passing by reference, meaning that it only swaps that array on that line and it doesn't remember the "new sorted" array while it continues in the loop…?
Great video. This is the most efficient way we can implement the bubble sort algorithm??
two levels of optimization.
boolean isSorted = false;
while(!isSorted) {
isSorted = true;
…..
Confused. Can some please explain?
This is the first time I have seen someone improve the efficiency of bubble-sort. Anyone who is really really new may not understand on the first go but this video is really well made.
the exam after 6 hours exactly, thanks alot <3
animation is so good. how did u do that?~
But doesn't the performance of this implementation depend heavily upon how isSorted is defined? Or if it is a built-in function? Considering that it is not and you write it out, then this will be a terrible algo because you check if the array is sorted or not each time you iterate through the loop! Can we do better than this?
great presentation, great explanation, great voice !!
Pleaseeeeeeeeeeeeeeeeeeeeee, Bubble sort in Python !@!!!!!!!!!!!!!!
Very nicely done. Gayle does an outstanding job here. I would like to see a similar presentation using C programming code. Thank you for providing this.
Exactly. Run. Nuclear. Vaginal. Wars. For. Space. Real. No. Shake. Em.
Thank you so much Gayle.
Straight after the while (!isSorted) condition, the next line is isSorted = true; so wouldn't the code just jump out there and never go through the following if statement? or will it complete the if statement first and then check whether to restart again?
Thank you Gayle for these brilliant videos that explain challenging coding techniques to junior programmers.
I really didn't get why everyone is saying bubble sort complexity is O(n^2),
Actually, if you consider the inner loop is getting shorter each time the outer loop loops,
You will find the execution complexity is O(n*(n-1)/2)
😤😑😑😑😑😓😓👹👿👹👹👹😮😮😓👐👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾👳🏾🙅🏿♂️
00:55 it should be O(n) space, because we've got one array of n elements. Or she just thought ok additional space that we need except for the array holding n elements is 0 so its constant => O(1) …
See my solution in c, c++, python and java
http://code2begin.blogspot.com/2016/12/bubble-sort-algorithm.html