Комментарии:
GFG please use Green color for Thumbnails . It easy for us figure out GFG videos from others😇
ОтветитьBasically bubble sort on a binary tree, which is why you get complexity log n instead of n since you sift up a tree instead of through the entire array
Ответитьwhat's worse than a thick accent? the answer is a loud obnoxious backgrounds music.
Ответитьwhy the for loop is starting from n/2 -1 ?
ОтветитьI could promote my sort algorithm but the comment will be deleted as always, so I won't 😿
Ответитьcomment
Ответитьif 4 is greater than 3, why isnt 3 at the bottom?
Ответитьgreat animation
Ответитьvery helpful
Ответитьwow
ОтветитьI thought a max heap was greatest to smallest. Is this not a min heap?
ОтветитьIt took me several views to understand. It might be good to emphasize the fact that when you are going to change the top biggest node with the last node from the heap (not the smallest).
ОтветитьSoftware Elfs!
Ответитьthank you
Ответитьunderstood how heap algo works clearly..thanks Arjun Tyagi and GFG
ОтветитьReally hating the white on bright green.
ОтветитьGreat in 2 minutes it's GREAT VIDEO !!!!
ОтветитьThanks for these shorts it helps us build up basics in mind or whenever we have to just revise our concepts
ОтветитьThanks!
Ответить😭😭😭😭thank you so much you never disappoint
ОтветитьBubble Sort
Selection Sort
Insertion Sort
Quick Sort
Merge Sort
Shell Sort
import java.util.Random;
public class HeapSort {
public void Heapsort(int A[]) {
BuildHeap(A);
for (int i = A.length - 1; i > 0; i--) {
int temp = A[0];
A[0] = A[i];
A[i] = temp;
Heapify(A, i, 0);
}
}
public void BuildHeap(int[] A) {
int heapsize = A.length;
for (int i = heapsize / 2 - 1; i >= 0; i--)
Heapify(A, heapsize, i);
}
void Heapify(int arr[], int heapsize, int i) {
int largest = i;
int l = 2 * i + 1;
int r = 2 * i + 2;
if (l < heapsize && arr[l] > arr[largest])
largest = l;
if (r < heapsize && arr[r] > arr[largest])
largest = r;
if (largest != i) {
int swap = arr[i];
arr[i] = arr[largest];
arr[largest] = swap;
Heapify(arr, heapsize, largest);
}
}
public void printArray(int arr[]) {
int n = arr.length;
for (int i = 0; i < n; ++i)
System.out.print(arr[i] + " ");
System.out.println();
}
public static void main(String args[]) {
int A[]= new int[20];
HeapSort hs = new HeapSort();
Random ran = new Random();
for (int i = 0; i < 20; i++) {
A[i] = ran.nextInt(100);
}
System.out.println("Before sorted Array A");
hs.printArray(A);
hs.Heapsort(A);
System.out.println("After sorted Array A");
hs.printArray(A);
}
}
Here is a java code with 20 random variables
To the point video! Good job!
ОтветитьI am just amazed that once in history, somebody, somehow had a time and energy to think about this HeapSort algorithm. I appreciate it though. It's brilliant.
ОтветитьAlways a great intuitive video. Well done! However I'm actually asking myself wether or not in 2022 knowing the internals of heapsort (as a software developer) would benefit me. I know costs, and where to apply it. It seems to me like knowledge simply for its own sake.
Ответить❤
Ответитьif anyone here still studying at school let me advice you something don't forget those or you need to come here again to learn again for job interview exams
ОтветитьWhat is the name of the song?
ОтветитьI am adding in a comment to let you know that I appreciate your love of spreading ease around the world, too. Thank you so much from the depth of heart!!!!!!!!!
ОтветитьI understood clearly after watching 5times thanks....
ОтветитьI was really confused on wether or not you could do the heapsort from the top to the bottom, or it was necessary to do it from bottom level to top, since the first method would increase number of operations, but I look at your video, where you basically do them both.
ОтветитьThank you so much for this video, i finnaly understood it !!!! I've been reading so many definitions of what heapsort is, and I couldn't wrap my head around it, now it finally makes sense :D
ОтветитьMaximum volume by various surface area
Like triangle🔺 🔲squares rectangle rhombus etc
What if there are 6 or more indexes. How to do?
ОтветитьFor min heap sort also can you please upload a vedio :)
ОтветитьInteresting! Understood it, but seems like hell to implement in code...
ОтветитьGreat! Thank you
ОтветитьWhy not use a min heap? In this way you don't even need to swap the first and the last
ОтветитьMaza aa gya
ОтветитьBest ever illustrated
ОтветитьNo nuisance only concept best vdo💪
ОтветитьOnline Bookstore
ОтветитьWell explained!
Ответитьit is so complicated
Ответитьbootom-up heapsort?
Ответитьif both child nodes are greater than the parent node,which of the two should swapped to make a max heap?
ОтветитьWhat do you use to produce these videos? I am a tutor and would like to produce instructional videos for my students.
Ответить