Тёмный

Huffman coding step-by-step example 

Pizzey Technology
Подписаться 4,8 тыс.
Просмотров 150 тыс.
50% 1

Another example for my students learning Huffman coding. In this video I show you how to build a Huffman tree to code and decode text.

Опубликовано:

 

6 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 80   
@Aaliyah1909
@Aaliyah1909 8 месяцев назад
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!!
@w花b
@w花b 8 месяцев назад
Just 5 minutes to understand that. Couldn't be more concise. Great job
@boredguy5805
@boredguy5805 Год назад
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
@glitterfart
@glitterfart 10 месяцев назад
Thanks man, have a test tomorrow.
@oguzhanalasulu5678
@oguzhanalasulu5678 4 месяца назад
I also realized it. Thanks for feedback about this situation, bud!
@jonatahnelhadad7430
@jonatahnelhadad7430 3 месяца назад
i also failed my question i came back after failing and sadly only now i noticed your comment...
@liam_iam
@liam_iam 3 месяца назад
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.
@user-vv6lm1sx7s
@user-vv6lm1sx7s 28 дней назад
Yeah cuz I was like somethings wrong here had to browse the web for minutes thanks tho!!
@Lerieal
@Lerieal 2 года назад
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.
@mikhailwebb8377
@mikhailwebb8377 9 месяцев назад
how did the exam went?
@sahitdodda5046
@sahitdodda5046 4 месяца назад
​@@mikhailwebb8377not well for them, the convention is to have the bigger value on the right, NOT the left. The video gets it wrong
@MoguMogu818
@MoguMogu818 4 месяца назад
I had a two hour lab on Huffman coding and couldn't understand shit. This taught me instantly when you mentioned "priority queue".
@damarisgoumtsop6319
@damarisgoumtsop6319 4 месяца назад
what school you going to if i may ask ?. I've the same lab lol
@jackc7475
@jackc7475 Год назад
Perfect video, with clear concise demonstration, fully helped me understand Huffman coding, thank you
@xfxdedfade6387
@xfxdedfade6387 7 месяцев назад
This was so concise, I have a presentation tomorrow and this saved me, thank you.
@mattels
@mattels Год назад
Amazing Video, I spent maybe an hour trying other videos to understand this, but somehow you managed in just under 5 minutes.
@christio02
@christio02 9 месяцев назад
Thank you! You explained better than a 3 hour lecture did
@dider
@dider 8 месяцев назад
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.
@badbanana2547
@badbanana2547 5 месяцев назад
Thank you! I read through all the comments looking for this specific thing
@dankmemes3447
@dankmemes3447 2 месяца назад
5 minutes and i understood it! thanks for saving my bachelors for now
@Connapasko
@Connapasko 4 месяца назад
this broke my brain in college and somehow you made it so clear in
@kamalkishor1493
@kamalkishor1493 10 месяцев назад
Brother, You are tremendous... I Love the way you explained!!
@MagnificientLlama
@MagnificientLlama Год назад
You sir are wonderful help for my finals preparation
@rygerety8384
@rygerety8384 2 года назад
Was searching through this and found this video... I had completely forgotten that u had made a vid on this
@vishwajeet5051
@vishwajeet5051 10 месяцев назад
this was just what i was searching for
@Backflipmarine
@Backflipmarine 3 года назад
thanks for the vid, also learnt 5678 (56=7*8), easy way to remember
@princeofexcess
@princeofexcess 2 месяца назад
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.
@matansavage
@matansavage 3 дня назад
amazing tutorial thanks
@user-sc2dc4ud7b
@user-sc2dc4ud7b 20 дней назад
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
@yasmineguemri
@yasmineguemri 2 месяца назад
amazing video! thanks !!
@melihcanyldz368
@melihcanyldz368 Год назад
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
@baraa2459
@baraa2459 3 месяца назад
True, thank you for noticing I thought my lectures were wrong 😂
@marianosalcedo3803
@marianosalcedo3803 Год назад
You explained this so well, thank you
@sunilbrevannavar1379
@sunilbrevannavar1379 Месяц назад
how does one break the tie of frequencies , alphabetical order?
@staa6589
@staa6589 2 месяца назад
thank you very much, very nice explanation
@a96futurecreator96
@a96futurecreator96 Год назад
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.
@kamalkishor1493
@kamalkishor1493 10 месяцев назад
In very first step, You have to decide where you want to put the element. Either on left or right side.
@baraa2459
@baraa2459 3 месяца назад
True, it was a mistake i think and few people noticed it !!!!!
@FoxGlove8
@FoxGlove8 10 дней назад
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!
@hoki8296
@hoki8296 Год назад
It was really helpful. Thank you
@mr.zafner8295
@mr.zafner8295 11 месяцев назад
What an excellent explanation. Thank you so much
@PizzeyTechnology
@PizzeyTechnology 11 месяцев назад
Glad it was helpful!
@rummanchowdhury3807
@rummanchowdhury3807 Год назад
Great succinct explanation!
@rain_yy
@rain_yy 5 месяцев назад
Thank you!
@Hustlers_hab
@Hustlers_hab 7 месяцев назад
enjoying the beat.
@PaulG106
@PaulG106 2 года назад
Wow! Thank you!!
@PizzeyTechnology
@PizzeyTechnology 2 года назад
Welcome!
@LugiPaule
@LugiPaule 4 месяца назад
great video bro
@Timmy-oo2vx
@Timmy-oo2vx Год назад
really good vdo I recommend this
@tiradeee
@tiradeee 3 года назад
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?
@rygerety8384
@rygerety8384 2 года назад
Not always, but usually
@douggale5962
@douggale5962 4 месяца назад
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.
@SpacePunk1000
@SpacePunk1000 4 месяца назад
at 1:38 B and 2 are equal so does it matter which you put first? Could you put A then 2 then B?
@TimnitAsamnew
@TimnitAsamnew 7 месяцев назад
i did not get why you write A3 on the right side
@sat_this_h
@sat_this_h 6 месяцев назад
Yes, I think it should be on the left since it's smaller than 4
@Ahmedibrahim-xv1je
@Ahmedibrahim-xv1je 5 месяцев назад
Should be on left
@victoralvarez9601
@victoralvarez9601 3 месяца назад
whats the song in the background?
@mikebabz
@mikebabz Год назад
The background music is intruding
@Yureka-ox5jn
@Yureka-ox5jn 5 месяцев назад
What about the codes to decode? Are they also transferred with the file?
@leoliang1
@leoliang1 9 месяцев назад
Hey your huffman tree is backwards. The smaller ones should go on the left
@JeezVince
@JeezVince Год назад
excellent
@MB31TheG
@MB31TheG Год назад
genius , thank you
@caitlinn3455
@caitlinn3455 3 года назад
thank you
@PizzeyTechnology
@PizzeyTechnology 3 года назад
You're welcome
@arunimachakraborty1175
@arunimachakraborty1175 Год назад
Thanks a lot!
@nc737
@nc737 4 месяца назад
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
@GoodNewsJim
@GoodNewsJim 3 года назад
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
@vampire_catgirl
@vampire_catgirl 2 года назад
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
@minecaftlichking
@minecaftlichking Год назад
thanks
@StracheyLou-h3e
@StracheyLou-h3e 3 дня назад
Cleora Mission
@galbalandroid
@galbalandroid 2 года назад
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?
@homeopathicfossil-fuels4789
@homeopathicfossil-fuels4789 7 дней назад
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!!!!!!
@alessandrolobosco7686
@alessandrolobosco7686 7 месяцев назад
This tutorial is totally wrong :)
@alessandrolobosco7686
@alessandrolobosco7686 7 месяцев назад
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. 😁
@lowlife5011
@lowlife5011 Год назад
W video
@user-ly6ws4wt5m
@user-ly6ws4wt5m Год назад
this is wrong the answer is A= 0 b= 10 c=110 d=111
@ickebins6948
@ickebins6948 5 месяцев назад
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.
@kacperkwasny3848
@kacperkwasny3848 3 месяца назад
ktos kik?
@ahmetsahin1147
@ahmetsahin1147 3 месяца назад
i have orgazm watching this
@slenderzx1556
@slenderzx1556 3 месяца назад
bro does NOT know what hes doing
Далее
Huffman Codes: An Information Theory Perspective
29:11
Просмотров 228 тыс.
3.4 Huffman Coding - Greedy Method
17:44
Просмотров 1,6 млн
لدي بط عالق في أذني😰🐤👂
00:17
Bellman-Ford in 5 minutes - Step by step example
5:10
How Huffman Trees Work - Computerphile
11:07
Просмотров 252 тыс.
Text Compression with Huffman Coding
6:10
Просмотров 118 тыс.
Huffman Coding
19:29
Просмотров 309 тыс.
Der Huffman Code | Algorithmen und Datenstrukturen
6:12
لدي بط عالق في أذني😰🐤👂
00:17