So add the numbers and then swap them until highest number at top?
@elyartaker113922 күн бұрын
wow thank you for this
@jortor2932Ай бұрын
Come back zooce dude btw how are you
@Z00CEАй бұрын
@@jortor2932 Thank you for asking! I’ve never been better. No new videos coming anytime soon (you never know I guess), but I’m very glad that people continue to get value from them.
@jortor2932Ай бұрын
@Z00CE ohh ok fine btw is everything alright in life
@TrilochanVYannawar2 ай бұрын
Very helpful man. Thanks a lot.
@surbhikharche23174 ай бұрын
I am looking for decision tree using quick sort algorithm, any clue?
@UrkoCornejo6 ай бұрын
Thank you best heapify explanation i saw !!🦾
@wangbiqing28886 ай бұрын
Visually I see the last swap between 5 and 37. but programmatically how to detect the disorder after looping all node index?
@mashrifrishal85458 ай бұрын
I can't imagine this is a video from 10 years ago and I am surprised that it didn’t get the rich.Wow!!Very rare video of dfs in directed graph
@teeheeee78078 ай бұрын
Thank u so much it helps a lot 💗
@Денис-ж3ф5р8 ай бұрын
You’re out of this world
@Vlad-rk5go8 ай бұрын
3:45 why do we swap 97 and 1 instead of 97 and 12? Even overall I can't see any benefits over using a binary tree.
@tomwerges84333 ай бұрын
The swap 97 and 1 actually occurred at 3:05. He just didn't bother update thr array representation up top until later. The algorithm for create-max-heap always starts with half the total nodes, or node 4, then the max-heapify routine considers the children of that node. This is superior to a binary tree in some cases because a binary tree would need to be re-sorted completely with each insertion which would be slower. Even though this tree is not completely sorted, it still has the property that removing the top node and heapifying will always result in the nodes coming off in reverse order of size. Also, the nodes are actually stored in an array, and not connected by pointers as in a binary tree, so there would be much less pointer dereferencing which would be faster.
@photocide179 ай бұрын
Thank you, finally a good video on dfs timestamps.
@MrShinCup9 ай бұрын
-25n <= -25n^2 cannot be true for natural numbers n btw
@nurulfadillah124810 ай бұрын
this is really helpful, thank you!
@logan211610 ай бұрын
great explanation
@nowherelefttojump10 ай бұрын
i owe you my entire life
@garic842311 ай бұрын
10 years later this is still really helpful!
@shashankjoshi825011 ай бұрын
At the end you are not adding the cost of leaves
@aimannasir583311 ай бұрын
Why you have stopped making such a quality videos??
@anhkhoi2926 Жыл бұрын
thanks bro
@juanivillanueva7873 Жыл бұрын
saved my day bro
@maxkellerer1923 Жыл бұрын
wish that someone explained like this in the lecture
@antoinekammouni Жыл бұрын
kteer btna3es kes emak
@Lukas-bb4sg Жыл бұрын
Thanks
@batuhanbayr7613 Жыл бұрын
KZbin AWARDS GOES TO..
@approachableGoals Жыл бұрын
Thank you so much! I finally understand how we get that table(or two matrix) step by step! This is the best explanation I found!
@tourdesource Жыл бұрын
That's a pretty stupid algorithm, unless you have very unusual memory constraints.
@itsvignan Жыл бұрын
does insertion of nodes always be in red initially?
@andrewwatts1997 Жыл бұрын
Can someone explain to me why after each instruction you add 4 to the program counter. Asuming you have an 8 bit rom, getting a 32 bit instruction field would require you to cycle through 4 adresses to begin with. What's the point to adding 4 after that ? Is there a secret two bit counter somewhere that's not displayed and this is just an over simplification ?
@ozzyfromspace Жыл бұрын
Watched at x2 and it immediately brought the algorithm back. Clearly you're amazing at presenting information. Thanks, mate!
@muratpinkman9679 Жыл бұрын
Finally i found someone who is not from india
@chaitanyabalanagu626 Жыл бұрын
For those wondering how this algorithm works as it stops in the middle, you need to write a condition to check if maxHeap property is applied for the whole list everytime and repeat the process of heapify if it fails, here is an example import java.util.Arrays; public class MyClass { static boolean maxHeapFormed = false; public static void main(String args[]) { int[] nums = {5,12,64,1,37,90,91,97}; while(maxHeapFormed == false){ maxHeapify(nums); checkMaxHeap(nums); } System.out.println(Arrays.toString(nums)); } public static void checkMaxHeap(int[] nums){ int leftChild; int rightChild; for(int i = nums.length/2;i>=0;i--){ leftChild = 2*i+1; rightChild = 2*i+2; if(leftChild < nums.length && nums[leftChild] > nums[i]) return; else if(rightChild < nums.length && nums[rightChild] > nums[i]) return; } maxHeapFormed = true; } public static void maxHeapify(int[] nums){ int length = nums.length; for(int i = nums.length/2;i>=0;i--){ heapify(nums,i); } } public static void heapify(int[] nums, int i){ int maxValue = i; int leftChild = 2*i+1; int rightChild = 2*i+2; if(leftChild < nums.length && nums[leftChild] > nums[maxValue]) maxValue = leftChild; if(rightChild < nums.length && nums[rightChild] > nums[maxValue]) maxValue = rightChild; if(maxValue != i) swap(nums,maxValue,i); } public static void swap(int[] nums,int highest, int i){ int temp = nums[highest]; nums[highest] = nums[i]; nums[i] = temp; } }
@fog1257 Жыл бұрын
Thanks!
@theone6853 Жыл бұрын
Your explanation is very easy to understand
@devinj374 Жыл бұрын
fantastic video!
@coyotulnegru Жыл бұрын
thank you mister
@Lordycal Жыл бұрын
ngl this made no sense. How did you have that graph already made? shouldnt you be making it as you go?
@masterjif95068 ай бұрын
Well it doesn’t matter now cause you passed your exam anyway
@tomwerges84333 ай бұрын
The graph doesn't actually exist. It's just a visual representation of what's in the array. He draws the whole thing for demonstration purposes.
@qwertek8413 Жыл бұрын
thanks ;)
@43_ayonroy42 жыл бұрын
I have to submit an assignment tomorrow but I also have an exam on the same day. I need help
@noodleboi50532 жыл бұрын
8 years ago and his mic sound better than mine
@B0BHD Жыл бұрын
its quiet af
@noodleboi5053 Жыл бұрын
im done with math dont remind me of this era@@B0BHD
@B0BHD Жыл бұрын
@@noodleboi5053 LOL im not sadly have an exam on Tuesday. Just added that this video is veeery quiet haha
@kendellferguson50212 жыл бұрын
Who knew Ben Shapiro would be teaching me Data Structures lol Great Video btw
@ti62522 жыл бұрын
thank you my savior
@wristocrat2 жыл бұрын
I enjoyed the part where you sniffed and smacked your lips. Oh wait, that was the entire video
@natsuvatsan61082 жыл бұрын
What about min heap?
@RelaxationVideos992 жыл бұрын
Where are you now zooce
@dauferm2 жыл бұрын
right? right? right? right? so insufferable.
@Ayanshandseals2 жыл бұрын
This is absolutely amazing video with very much on-point run of DFS with pre and post numbers for the algorithm. Thank You!
@chrise2022 жыл бұрын
at 5:10, after i=1, your algorithm stops according to the code (for i=1 to 1). You have not explained how did you found out that the LEFT child of index i=1 does not align with the max_heap rules. You did it via visual inspection instead :(
@williamshaoul808811 ай бұрын
The way we'd know if a node did not follow max_heap rules is by having the maxHeapify function being recursive. There is a conditional at the top of the algorithm that checks if A) the node we are at is a leaf or B) either child of the node has a value that is greater than the current node's value that is being passed through. If the current node is a leaf we can't heapifyDown anymore, but if either child is greater we check which one has a greater value and do a regular swap. Then we recursively call the function again. This process allows for a natural "trickle" down the heap, and for the recursion to be killed if the base case conditional is true (the current node is a leaf OR both children are less than the current value)..
@colecook83410 ай бұрын
Thank you
@Fanaz108 ай бұрын
yea that was wack
@aaryan__bondekar97784 ай бұрын
ig its included in max heapify for recursive check
@BlokeBritish2 жыл бұрын
isn't there a way to gather the indexes of the subsequence while iterating through the array ?