5 minutes and you taught me more then my own lectures could, you kept in concise unlike other videos, straight to the point and very well worded. I thank you highly!!
i've been watching many videos explaining this lesson but couldn't understand it because they always miss the point that i should move the bigger value to the left, i have a final exam after 4 days and now i'm ready for it because of you, thank you so much.
I failed my quiz because of this video, should have read the comments first. Everyone be warned, the lower frequency number must always be on the left, not the right, this is not something he practices in this video. Where he goes wrong is that he sorts from highest frequency to lowest in the queue, when it should be the opposite
it doesn't matter which way you visualise the queue (left/right), it matters which side you take the elements out of the queue (you should be taking the lowest frequency elements). I don't think the video creator is at fault for this.
This is how to decode properly: 1. Take a bit from the encoded string. 2. Start at the root of the tree. 3. Follow the edge denoted by that bit value to the adjacent node. 4. If the node is a leaf, then return the corresponding character. 5. Otherwise take the next bit from the encoded string and continue following down the tree until a leaf node is found. Example: 1. Start with the first bit in the encoded string, which is 1. 2. Start at the root of the tree. 3. The root is obviously not a leaf, so follow the edge marked 1 and we reach the leaf node, which is ''A'. 4. Then take the next bit, which is also 1. So, follow the step 3 above and return 'A' again. 5. Then take the next bit, which is 0 and start at the root again. 6. The edge 0 from the root leads to a non-leaf node (marked 4). 7. So, take the next bit from the encoded string, which is also 0 and continue following from the last node where we were at in the last step (which is the non-leaf node 4). 8. If we follow the edge 0, we reach a leaf node denoting character 'B'. 9. And so on.. The important point is every time we find a character, we take the next bit from the encoded string and start at the root of the tree.
How would it work if there were more symbols to account for? And then there would be I, and II in the same algorithm. How would we know to differentiate between 2 I or 1 II? Hope I'm making some sense!
The space key is also an ascii code. So you can include spaces as part of your encoding, or try to guess where the space should be, if the code is in a natural language you understand.
I think this answer is wrong because of that we need to write the small number to the left side of the tree . you have done the opposite . I mentioned the 2:02
This cheats a little bit though - how does the decoder side magically know the Huffman tree? In actual practice, the part that sometimes needs a ton of cleverness is compactly encoding the tree into the output. Sometimes you can get away with a hard-coded tree that works well most of the time.
Its important that you encode and decode the same way. Ideally you would have the full tree to transfer to a decoder. However, a professor did give us a task to decode a binary string and we were supposed to work backwards to figure out the tree and decode it. You should know that this is not the practical way in which this is used. Funny enough, the professor got the code from some website probably (GeeksForGeeks) and they did the encoding differently from the way he taught us so we couldnt get the answer and the professor apologized and said he would just give us points for it. If you have to decode, you just have to take a guess how the professor did it (alphabetical order makes sense), and if he marks you wrong argue that you did it correctly, but had a different approach.
I would appreciate this even more if you had mentioned the property of prefix-free codes. otherwise, one could get confused about how to determine where one code ends and the next one begins.
The node with value 4 should be on the right side instead of A3 because it has a larger value. So, node with value 7 has left child of A3 and right child of 4
I actually understand how this works now... I just wonder... about those... like extra... those non usable extra bits people chuck out... Like... You think they could be used for extraneous packing somehow? Hmmmm. I dunno, this is good enough. You explained in a few seconds(knew where to fast forward) where profs you tube videos couldn't
Yeah but where would you store the tree structure? That is still ambivalent to me, without the tree you cant figure out what is what oh wait I get it, its like any other thing where the table is generated instead of static, you store the table, or at least enough information to generate it alright there we go thank you!!!!!!
1- You have to use a priority queue. 2- IF a number is bigger you have to put this number in the right of the tree, if is smaller in the left, you are giving wrong informations. Please, delete this video and make the correct video. 😁
No, if you change the A to the left side (0) you have to switch the whole tree. The pattern of left = 0 & right = 1, has to be the same for the whole tree.
5 minutes and you taught me more then my own lectures could, you kept in concise unlike other videos, straight to the point and very well worded. I thank you highly!!
Just 5 minutes to understand that. Couldn't be more concise. Great job
i've been watching many videos explaining this lesson but couldn't understand it because they always miss the point that i should move the bigger value to the left, i have a final exam after 4 days and now i'm ready for it because of you, thank you so much.
how did the exam went?
@@mikhailwebb8377not well for them, the convention is to have the bigger value on the right, NOT the left. The video gets it wrong
@@sahitdodda5046 This is wrong. Huffman trees do not care about if the bigger value is right or left, both solutions are correct.
Perfect video, with clear concise demonstration, fully helped me understand Huffman coding, thank you
This was so concise, I have a presentation tomorrow and this saved me, thank you.
Thank you! You explained better than a 3 hour lecture did
Amazing Video, I spent maybe an hour trying other videos to understand this, but somehow you managed in just under 5 minutes.
I had a two hour lab on Huffman coding and couldn't understand shit. This taught me instantly when you mentioned "priority queue".
what school you going to if i may ask ?. I've the same lab lol
@@damarisgoumtsop6319 what bout you
I failed my quiz because of this video, should have read the comments first. Everyone be warned, the lower frequency number must always be on the left, not the right, this is not something he practices in this video.
Where he goes wrong is that he sorts from highest frequency to lowest in the queue, when it should be the opposite
Thanks man, have a test tomorrow.
I also realized it. Thanks for feedback about this situation, bud!
i also failed my question i came back after failing and sadly only now i noticed your comment...
it doesn't matter which way you visualise the queue (left/right), it matters which side you take the elements out of the queue (you should be taking the lowest frequency elements). I don't think the video creator is at fault for this.
Yeah cuz I was like somethings wrong here had to browse the web for minutes thanks tho!!
Brother, You are tremendous... I Love the way you explained!!
This is how to decode properly:
1. Take a bit from the encoded string.
2. Start at the root of the tree.
3. Follow the edge denoted by that bit value to the adjacent node.
4. If the node is a leaf, then return the corresponding character.
5. Otherwise take the next bit from the encoded string and continue following down the tree until a leaf node is found.
Example:
1. Start with the first bit in the encoded string, which is 1.
2. Start at the root of the tree.
3. The root is obviously not a leaf, so follow the edge marked 1 and we reach the leaf node, which is ''A'.
4. Then take the next bit, which is also 1. So, follow the step 3 above and return 'A' again.
5. Then take the next bit, which is 0 and start at the root again.
6. The edge 0 from the root leads to a non-leaf node (marked 4).
7. So, take the next bit from the encoded string, which is also 0 and continue following from the last node where we were at in the last step (which is the non-leaf node 4).
8. If we follow the edge 0, we reach a leaf node denoting character 'B'.
9. And so on..
The important point is every time we find a character, we take the next bit from the encoded string and start at the root of the tree.
Thank you! I read through all the comments looking for this specific thing
5 minutes and i understood it! thanks for saving my bachelors for now
this broke my brain in college and somehow you made it so clear in
You sir are wonderful help for my finals preparation
Astonishing explanation, thank you!
2:15 why is 4 at left side of 3 (node a3), I thought everything bigger than the node should go to the right side.
In very first step, You have to decide where you want to put the element. Either on left or right side.
True, it was a mistake i think and few people noticed it !!!!!
this was just what i was searching for
Was searching through this and found this video... I had completely forgotten that u had made a vid on this
Do you have to put the A3 or each last part on the right?
How would it work if there were more symbols to account for? And then there would be I, and II in the same algorithm. How would we know to differentiate between 2 I or 1 II? Hope I'm making some sense!
thanks for the vid, also learnt 5678 (56=7*8), easy way to remember
This explanation works. Thx
thx you mate you saved me A LOT OF TIME liked the video
You explained this so well, thank you
at 1:38 B and 2 are equal so does it matter which you put first? Could you put A then 2 then B?
when sending on the network you also have to send the tree to decode it on the other side. So i doesnt pay of for short strings.
I just have a question about the decoding part, how do we identify the code without the spaces ?
The space key is also an ascii code. So you can include spaces as part of your encoding, or try to guess where the space should be, if the code is in a natural language you understand.
I think this answer is wrong because of that we need to write the small number to the left side of the tree . you have done the opposite . I mentioned the 2:02
True, thank you for noticing
I thought my lectures were wrong 😂
thank you very much, very nice explanation
i did not get why you write A3 on the right side
Yes, I think it should be on the left since it's smaller than 4
Should be on left
i have my paper 2 FINAL gcse exam tomorrow, so one question: where u put the binary, is it ALWAYS 0 on the left and 1 on the right?
Not always, but usually
It was really helpful. Thank you
What about the codes to decode? Are they also transferred with the file?
This cheats a little bit though - how does the decoder side magically know the Huffman tree? In actual practice, the part that sometimes needs a ton of cleverness is compactly encoding the tree into the output. Sometimes you can get away with a hard-coded tree that works well most of the time.
precise..well done
how does one break the tie of frequencies , alphabetical order?
Its important that you encode and decode the same way. Ideally you would have the full tree to transfer to a decoder. However, a professor did give us a task to decode a binary string and we were supposed to work backwards to figure out the tree and decode it. You should know that this is not the practical way in which this is used. Funny enough, the professor got the code from some website probably (GeeksForGeeks) and they did the encoding differently from the way he taught us so we couldnt get the answer and the professor apologized and said he would just give us points for it. If you have to decode, you just have to take a guess how the professor did it (alphabetical order makes sense), and if he marks you wrong argue that you did it correctly, but had a different approach.
amazing video! thanks !!
amazing tutorial thanks
What an excellent explanation. Thank you so much
Glad it was helpful!
isnt it 8 bits for a character?
Great succinct explanation!
The decoding is not really explained by this -> how do we know to decode only 1 bit, from 1 to A vs 2 bits from 11 -> whatever
what to do if our tree (in the progress of building it) is for example 3 and we have 2 options 2 and 2.5 for example?
I would appreciate this even more if you had mentioned the property of prefix-free codes. otherwise, one could get confused about how to determine where one code ends and the next one begins.
still, that's hell of a job the way you explained it, thank you so much!
The node with value 4 should be on the right side instead of A3 because it has a larger value. So, node with value 7 has left child of A3 and right child of 4
I guess the smaller should be on the left ?
enjoying the beat.
really good vdo I recommend this
Hey your huffman tree is backwards. The smaller ones should go on the left
Thank you!
The background music is intruding
Wow! Thank you!!
Welcome!
great video bro
ez finals thanks to you
whats the song in the background?
thank you
You're welcome
excellent
Thanks a lot!
genius , thank you
thanks:)
thanks
I actually understand how this works now... I just wonder... about those... like extra... those non usable extra bits people chuck out... Like... You think they could be used for extraneous packing somehow? Hmmmm. I dunno, this is good enough.
You explained in a few seconds(knew where to fast forward) where profs you tube videos couldn't
I don't think so, if you made them do anything then whatever code you use to decompress wouldn't know to keep going for a letter
Cleora Mission
ktos kik?
Yeah but where would you store the tree structure? That is still ambivalent to me, without the tree you cant figure out what is what
oh wait I get it, its like any other thing where the table is generated instead of static, you store the table, or at least enough information to generate it
alright there we go
thank you!!!!!!
Douglas Wall
This tutorial is totally wrong :)
1- You have to use a priority queue.
2- IF a number is bigger you have to put this number in the right of the tree, if is smaller in the left, you are giving wrong informations.
Please, delete this video and make the correct video. 😁
I got confused watching the video. The I read the comment section and read so many people failed their exams because of this video. Just wow.
Jabari Estates
i have orgazm watching this
this is wrong the answer is A= 0 b= 10 c=110 d=111
No, if you change the A to the left side (0) you have to switch the whole tree.
The pattern of left = 0 & right = 1, has to be the same for the whole tree.
W video
bro does NOT know what hes doing