{"id":78203,"date":"2020-04-17T13:42:42","date_gmt":"2020-04-17T11:42:42","guid":{"rendered":"https:\/\/prohoster.info\/blog\/administrirovanie\/algoritm-szhatiya-haffmana"},"modified":"2020-04-17T13:42:42","modified_gmt":"2020-04-17T11:42:42","slug":"algoritm-szhatiya-haffmana","status":"publish","type":"post","link":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/algoritm-szhatiya-haffmana","title":{"rendered":"Algoritmi i kompresimit Huffman","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><i><b>\u0412 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 \u043a\u0443\u0440\u0441\u0430 <noindex><a rel=\"nofollow\" href=\"https:\/\/otus.pw\/Hkvk\/\">\u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432\u00bb<\/a><\/noindex> \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0434\u043b\u044f \u0432\u0430\u0441 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430.<\/b><\/i><\/p>\n<p>\n\u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430 \u2013 \u044d\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0436\u0430\u0442\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0438\u0434\u0435\u044e \u0441\u0436\u0430\u0442\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043a\u043e\u0434\u0430\u0445, \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445 \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430.<\/p>\n<p>\u041c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 0 \u0438 1 \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 8 \u0431\u0438\u0442. \u042d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0438\u0442\u043e\u0432 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f.<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<p><i>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0434\u0430\u043d \u0442\u0435\u043a\u0441\u0442. \u041a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0435\u0441\u0442\u0430, \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0433\u043e \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430?<\/i><\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0447\u0430\u0449\u0435, \u0447\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0435 (<noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/Letter_frequency\">\u0441\u043c. \u0437\u0434\u0435\u0441\u044c<\/a><\/noindex>), \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0443 \u0436\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043c\u0435\u043d\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0431\u0438\u0442\u043e\u0432. \u041f\u0440\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b \u043c\u044b \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0438\u0442\u043e\u0432 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0438\u0445 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u0435. \u0412 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043c\u043e\u0433\u0443\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u043e 1 \u0431\u0438\u0442, \u0430 \u0434\u0440\u0443\u0433\u0438\u0435 2 \u0431\u0438\u0442\u0430, 3 \u0438\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p><i>\u041a\u0430\u043a, \u0437\u043d\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u0438\u0442\u043e\u0432, \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e?<\/i><\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0443 <i>\u00abaabacdab\u00bb<\/i>. \u0412 \u043d\u0435\u0439 8 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0438 \u043f\u0440\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b \u0434\u043b\u044f \u0435\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f 64 \u0431\u0438\u0442\u0430. \u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 <i>\u00aba\u00bb, \u00abb\u00bb, \u00abc\u00bb<\/i> \u0438 <i>\u00abd\u00bb<\/i> \u0440\u0430\u0432\u043d\u044f\u0435\u0442\u0441\u044f 4, 2, 1, 1 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c <i>\u00abaabacdab\u00bb<\/i> \u043c\u0435\u043d\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0431\u0438\u0442\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e <i>\u00aba\u00bb<\/i> \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0430\u0449\u0435, \u0447\u0435\u043c <i>\u00abb\u00bb<\/i>, \u0430 <i>\u00abb\u00bb<\/i> \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0430\u0449\u0435, \u0447\u0435\u043c <i>\u00abc\u00bb<\/i> \u0438 <i>\u00abd\u00bb<\/i>. \u041d\u0430\u0447\u043d\u0435\u043c \u043c\u044b \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c <i>\u00aba\u00bb<\/i> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0438\u0442\u0430, \u0440\u0430\u0432\u043d\u043e\u0433\u043e 0, <i>\u00abb\u00bb<\/i> \u043c\u044b \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u043c \u0434\u0432\u0443\u0445\u0431\u0438\u0442\u043d\u044b\u0439 \u043a\u043e\u0434 11, \u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0440\u0435\u0445 \u0431\u0438\u0442\u043e\u0432 100 \u0438 011 \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c <i>\u00abc\u00bb<\/i> \u0438 <i>\u00abd\u00bb<\/i>.<\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f:<\/p>\n<p>a<br \/>\n0<\/p>\n<p>b<br \/>\n11<\/p>\n<p>c<br \/>\n100<\/p>\n<p>d<br \/>\n011<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441\u0442\u0440\u043e\u043a\u0443 <i>\u00abaabacdab\u00bb<\/i> \u043c\u044b \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c \u043a\u0430\u043a <i>00110100011011 (0|0|11|0|100|011|0|11)<\/i>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043e\u0434\u044b, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435. \u041e\u0434\u043d\u0430\u043a\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438. \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 <i>00110100011011<\/i>, \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u043a:<\/p>\n<pre><code class=\"plaintext\">0|011|0|100|011|0|11    adacdab\n0|0|11|0|100|0|11|011   aabacabd\n0|011|0|100|0|11|0|11   adacabab \n<\/code><\/pre>\n<p>\n\u2026<br \/>\n\u0438 \u0442.\u0434.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u044d\u0442\u043e\u0439 \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0441\u0442\u0438, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u0448\u0435 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u0442\u0430\u043a\u043e\u043c\u0443 \u043f\u043e\u043d\u044f\u0442\u0438\u044e, \u043a\u0430\u043a <i>\u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e<\/i>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u043e\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u0438\u043c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c. \u041f\u0440\u0435\u0444\u0438\u043a\u0441\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u043d\u0438 \u043e\u0434\u0438\u043d \u043a\u043e\u0434 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u0433\u043e. \u041f\u043e\u0434 \u043a\u043e\u0434\u043e\u043c \u043c\u044b \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u043c \u0431\u0438\u0442\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430. \u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <i>0<\/i> \u2013 \u044d\u0442\u043e \u043f\u0440\u0435\u0444\u0438\u043a\u0441 <i>011<\/i>, \u0447\u0442\u043e \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e. \u0418\u0442\u0430\u043a, \u0435\u0441\u043b\u0438 \u043d\u0430\u0448\u0438 \u043a\u043e\u0434\u044b \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0442 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043d\u043e\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0443, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (\u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442). <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0448\u0435. \u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043c\u044b \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u043c \u0434\u043b\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 <i>\u00aba\u00bb, \u00abb\u00bb, \u00abc\u00bb<\/i> \u0438 <i>\u00abd\u00bb<\/i> \u043a\u043e\u0434\u044b, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0435 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043d\u043e\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0443.<\/p>\n<p>a<br \/>\n0<\/p>\n<p>b<br \/>\n10<\/p>\n<p>c<br \/>\n110<\/p>\n<p>d<br \/>\n111<\/p>\n<p>\u0421 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0441\u0442\u0440\u043e\u043a\u0430 <i>\u00abaabacdab\u00bb<\/i> \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043a\u0430\u043a <i>00100100011010 (0|0|10|0|100|011|0|10)<\/i>. \u0410 \u0432\u043e\u0442 <i>00100100011010<\/i> \u043c\u044b \u0443\u0436\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 <i>\u00abaabacdab\u00bb<\/i>.<\/p>\n<h3>\u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430<\/h3>\n<p>\n\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0441 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b \u0438 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043d\u044b\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u043e\u043c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432. \u0412 \u043d\u0435\u043c \u0443\u0437\u0435\u043b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u0438\u0431\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c, \u043b\u0438\u0431\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0432\u0441\u0435 \u0443\u0437\u043b\u044b \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u043b\u0438\u0441\u0442\u044c\u044f\u043c\u0438 (\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c\u0438), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u0430\u043c \u0441\u0438\u043c\u0432\u043e\u043b \u0438 \u0435\u0433\u043e \u0432\u0435\u0441 (\u0442\u043e \u0435\u0441\u0442\u044c \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f). \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0443\u0437\u043b\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0432\u0435\u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0438 \u0441\u0441\u044b\u043b\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0434\u0432\u0430 \u0443\u0437\u043b\u0430-\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430. \u041f\u043e \u043e\u0431\u0449\u0435\u043c\u0443 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044e, \u0431\u0438\u0442 <i>\u00ab0\u00bb<\/i> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u043b\u0435\u0432\u043e\u0439 \u0432\u0435\u0442\u0432\u0438, \u0430 <i>\u00ab1\u00bb<\/i> \u2014 \u043f\u043e \u043f\u0440\u0430\u0432\u043e\u0439. \u0412 \u043f\u043e\u043b\u043d\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u0435 <i>N<\/i> \u043b\u0438\u0441\u0442\u044c\u0435\u0432 \u0438 <i>N-1<\/i> \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0443\u0437\u043b\u043e\u0432. \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u043e\u0432 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b.<\/p>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0434\u0435\u0440\u0435\u0432\u0430 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430, \u0433\u0434\u0435 \u0443\u0437\u043b\u0443 \u0441 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d \u0432\u044b\u0441\u0448\u0438\u0439 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442. \u041d\u0438\u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0448\u0430\u0433\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f:<\/p>\n<ol>\n<li>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0443\u0437\u0435\u043b-\u043b\u0438\u0441\u0442 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0438\u0445 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0430\u043c\u0438.<\/li>\n<li>\u041f\u043e\u043a\u0430 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043b\u0438\u0441\u0442\u0430 \u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:\n<ul>\n<li>\u0423\u0434\u0430\u043b\u0438\u0442\u0435 \u0434\u0432\u0430 \u0443\u0437\u043b\u0430 \u0441 \u043d\u0430\u0438\u0432\u044b\u0441\u0448\u0438\u043c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043e\u043c (\u0441 \u0441\u0430\u043c\u043e\u0439 \u043d\u0438\u0437\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439) \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438;<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0443\u0437\u0435\u043b, \u0433\u0434\u0435 \u044d\u0442\u0438 \u0434\u0432\u0430 \u0443\u0437\u043b\u0430 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430\u043c\u0438, \u0430 \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u0430 \u0441\u0443\u043c\u043c\u0435 \u0447\u0430\u0441\u0442\u043e\u0442 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u0443\u0437\u043b\u043e\u0432.<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u0443\u0437\u0435\u043b \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043e\u0432.<\/li>\n<\/ul>\n<\/li>\n<li>\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0439\u0441\u044f \u0443\u0437\u0435\u043b \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0440\u043d\u0435\u0432\u044b\u043c, \u043d\u0430 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0434\u0435\u0440\u0435\u0432\u0430 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f.<\/li>\n<\/ol>\n<p>\n\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0435\u043a\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 <i>\u00aba\u00bb, \u00abb\u00bb, \u00abc\u00bb, \u00abd\u00bb<\/i> \u0438 <i>\u00abe\u00bb<\/i>, \u0430 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0438\u0445 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0432\u043d\u044b 15, 7, 6, 6 \u0438 5 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u0440\u0430\u0436\u0430\u044e\u0442 \u0448\u0430\u0433\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.<\/p>\n<p><img decoding=\"async\" alt=\"\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0436\u0430\u0442\u0438\u044f \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430\" src=\"\/wp-content\/uploads\/2020\/04\/964e2fcd5c23766a0faba7b9d5d99407.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\n<img decoding=\"async\" alt=\"\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0436\u0430\u0442\u0438\u044f \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430\" src=\"\/wp-content\/uploads\/2020\/04\/434ad1316f960a59bbc0d8afaf967a74.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\n<img decoding=\"async\" alt=\"\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0436\u0430\u0442\u0438\u044f \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430\" src=\"\/wp-content\/uploads\/2020\/04\/d6cdebca8869311e2c403445d9991643.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\n<img decoding=\"async\" alt=\"\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0436\u0430\u0442\u0438\u044f \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430\" src=\"\/wp-content\/uploads\/2020\/04\/24e4c49974dbc163110710c6809fa80c.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\n<img decoding=\"async\" alt=\"\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0436\u0430\u0442\u0438\u044f \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430\" src=\"\/wp-content\/uploads\/2020\/04\/a5f8b9e73d196e5f91aa699f4f4cf937.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\n\u041f\u0443\u0442\u044c \u043e\u0442 \u043a\u043e\u0440\u043d\u044f \u0434\u043e \u043b\u044e\u0431\u043e\u0433\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0443\u0437\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043d\u044b\u0439 \u043a\u043e\u0434 (\u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439, \u043a\u0430\u043a \u043a\u043e\u0434 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430), \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b\u0443, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0441 \u044d\u0442\u0438\u043c \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c \u0443\u0437\u043b\u043e\u043c.<\/p>\n<p><img decoding=\"async\" alt=\"\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0436\u0430\u0442\u0438\u044f \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430\" src=\"\/wp-content\/uploads\/2020\/04\/f365f77b4effec96e962e17a56871aca.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<i>\u0414\u0435\u0440\u0435\u0432\u043e \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430<\/i><\/p>\n<p>\u041d\u0438\u0436\u0435 \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0441\u0436\u0430\u0442\u0438\u044f \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0430\u0445 C++ \u0438 Java:<\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt;\n#include &lt;string&gt;\n#include &lt;queue&gt;\n#include &lt;unordered_map&gt;\nusing namespace std;\n\n\/\/ A Tree node\nstruct Node\n{\n\tchar ch;\n\tint freq;\n\tNode *left, *right;\n};\n\n\/\/ Function to allocate a new tree node\nNode* getNode(char ch, int freq, Node* left, Node* right)\n{\n\tNode* node = new Node();\n\n\tnode-&gt;ch = ch;\n\tnode-&gt;freq = freq;\n\tnode-&gt;left = left;\n\tnode-&gt;right = right;\n\n\treturn node;\n}\n\n\/\/ Comparison object to be used to order the heap\nstruct comp\n{\n\tbool operator()(Node* l, Node* r)\n\t{\n\t\t\/\/ highest priority item has lowest frequency\n\t\treturn l-&gt;freq &gt; r-&gt;freq;\n\t}\n};\n\n\/\/ traverse the Huffman Tree and store Huffman Codes\n\/\/ in a map.\nvoid encode(Node* root, string str,\n\t\t\tunordered_map&lt;char, string&gt; &amp;huffmanCode)\n{\n\tif (root == nullptr)\n\t\treturn;\n\n\t\/\/ found a leaf node\n\tif (!root-&gt;left &amp;&amp; !root-&gt;right) {\n\t\thuffmanCode[root-&gt;ch] = str;\n\t}\n\n\tencode(root-&gt;left, str + &quot;0&quot;, huffmanCode);\n\tencode(root-&gt;right, str + &quot;1&quot;, huffmanCode);\n}\n\n\/\/ traverse the Huffman Tree and decode the encoded string\nvoid decode(Node* root, int &amp;index, string str)\n{\n\tif (root == nullptr) {\n\t\treturn;\n\t}\n\n\t\/\/ found a leaf node\n\tif (!root-&gt;left &amp;&amp; !root-&gt;right)\n\t{\n\t\tcout &lt;&lt; root-&gt;ch;\n\t\treturn;\n\t}\n\n\tindex++;\n\n\tif (str[index] =='0')\n\t\tdecode(root-&gt;left, index, str);\n\telse\n\t\tdecode(root-&gt;right, index, str);\n}\n\n\/\/ Builds Huffman Tree and decode given input text\nvoid buildHuffmanTree(string text)\n{\n\t\/\/ count frequency of appearance of each character\n\t\/\/ and store it in a map\n\tunordered_map&lt;char, int&gt; freq;\n\tfor (char ch: text) {\n\t\tfreq[ch]++;\n\t}\n\n\t\/\/ Create a priority queue to store live nodes of\n\t\/\/ Huffman tree;\n\tpriority_queue&lt;Node*, vector&lt;Node*&gt;, comp&gt; pq;\n\n\t\/\/ Create a leaf node for each character\u00a0and add it\n\t\/\/ to the priority queue.\n\tfor (auto pair: freq) {\n\t\tpq.push(getNode(pair.first, pair.second, nullptr, nullptr));\n\t}\n\n\t\/\/ do till there is more than one node in the queue\n\twhile (pq.size() != 1)\n\t{\n\t\t\/\/ Remove the two nodes of highest priority\n\t\t\/\/ (lowest frequency) from the queue\n\t\tNode *left = pq.top(); pq.pop();\n\t\tNode *right = pq.top();\tpq.pop();\n\n\t\t\/\/ Create a new internal node with these two nodes\n\t\t\/\/ as children and with frequency equal to the sum\n\t\t\/\/ of the two nodes' frequencies. Add the new node\n\t\t\/\/ to the priority queue.\n\t\tint sum = left-&gt;freq + right-&gt;freq;\n\t\tpq.push(getNode('\u0000', sum, left, right));\n\t}\n\n\t\/\/ root stores pointer to root of Huffman Tree\n\tNode* root = pq.top();\n\n\t\/\/ traverse the Huffman Tree and store Huffman Codes\n\t\/\/ in a map. Also prints them\n\tunordered_map&lt;char, string&gt; huffmanCode;\n\tencode(root, &quot;&quot;, huffmanCode);\n\n\tcout &lt;&lt; &quot;Huffman Codes are :n&quot; &lt;&lt; 'n';\n\tfor (auto pair: huffmanCode) {\n\t\tcout &lt;&lt; pair.first &lt;&lt; &quot; &quot; &lt;&lt; pair.second &lt;&lt; 'n';\n\t}\n\n\tcout &lt;&lt; &quot;nOriginal string was :n&quot; &lt;&lt; text &lt;&lt; 'n';\n\n\t\/\/ print encoded string\n\tstring str = &quot;&quot;;\n\tfor (char ch: text) {\n\t\tstr += huffmanCode[ch];\n\t}\n\n\tcout &lt;&lt; &quot;nEncoded string is :n&quot; &lt;&lt; str &lt;&lt; 'n';\n\n\t\/\/ traverse the Huffman Tree again and this time\n\t\/\/ decode the encoded string\n\tint index = -1;\n\tcout &lt;&lt; &quot;nDecoded string is: n&quot;;\n\twhile (index &lt; (int)str.size() - 2) {\n\t\tdecode(root, index, str);\n\t}\n}\n\n\/\/ Huffman coding algorithm\nint main()\n{\n\tstring text = &quot;Huffman coding is a data compression algorithm.&quot;;\n\n\tbuildHuffmanTree(text);\n\n\treturn 0;\n}<\/code><\/pre>\n<p><\/p>\n<pre><code class=\"java\">import java.util.HashMap;\nimport java.util.Map;\nimport java.util.PriorityQueue;\n\n\/\/ A Tree node\nclass Node\n{\n\tchar ch;\n\tint freq;\n\tNode left = null, right = null;\n\n\tNode(char ch, int freq)\n\t{\n\t\tthis.ch = ch;\n\t\tthis.freq = freq;\n\t}\n\n\tpublic Node(char ch, int freq, Node left, Node right) {\n\t\tthis.ch = ch;\n\t\tthis.freq = freq;\n\t\tthis.left = left;\n\t\tthis.right = right;\n\t}\n};\n\nclass Huffman\n{\n\t\/\/ traverse the Huffman Tree and store Huffman Codes\n\t\/\/ in a map.\n\tpublic static void encode(Node root, String str,\n\t\t\t\t\t\t\t  Map&lt;Character, String&gt; huffmanCode)\n\t{\n\t\tif (root == null)\n\t\t\treturn;\n\n\t\t\/\/ found a leaf node\n\t\tif (root.left == null &amp;&amp; root.right == null) {\n\t\t\thuffmanCode.put(root.ch, str);\n\t\t}\n\n\n\t\tencode(root.left, str + &quot;0&quot;, huffmanCode);\n\t\tencode(root.right, str + &quot;1&quot;, huffmanCode);\n\t}\n\n\t\/\/ traverse the Huffman Tree and decode the encoded string\n\tpublic static int decode(Node root, int index, StringBuilder sb)\n\t{\n\t\tif (root == null)\n\t\t\treturn index;\n\n\t\t\/\/ found a leaf node\n\t\tif (root.left == null &amp;&amp; root.right == null)\n\t\t{\n\t\t\tSystem.out.print(root.ch);\n\t\t\treturn index;\n\t\t}\n\n\t\tindex++;\n\n\t\tif (sb.charAt(index) == '0')\n\t\t\tindex = decode(root.left, index, sb);\n\t\telse\n\t\t\tindex = decode(root.right, index, sb);\n\n\t\treturn index;\n\t}\n\n\t\/\/ Builds Huffman Tree and huffmanCode and decode given input text\n\tpublic static void buildHuffmanTree(String text)\n\t{\n\t\t\/\/ count frequency of appearance of each character\n\t\t\/\/ and store it in a map\n\t\tMap&lt;Character, Integer&gt; freq = new HashMap&lt;&gt;();\n\t\tfor (int i = 0 ; i &lt; text.length(); i++) {\n\t\t\tif (!freq.containsKey(text.charAt(i))) {\n\t\t\t\tfreq.put(text.charAt(i), 0);\n\t\t\t}\n\t\t\tfreq.put(text.charAt(i), freq.get(text.charAt(i)) + 1);\n\t\t}\n\n\t\t\/\/ Create a priority queue to store live nodes of Huffman tree\n\t\t\/\/ Notice that highest priority item has lowest frequency\n\t\tPriorityQueue&lt;Node&gt; pq = new PriorityQueue&lt;&gt;(\n\t\t\t\t\t\t\t\t\t\t(l, r) -&gt; l.freq - r.freq);\n\n\t\t\/\/ Create a leaf node for each character\u00a0and add it\n\t\t\/\/ to the priority queue.\n\t\tfor (Map.Entry&lt;Character, Integer&gt; entry : freq.entrySet()) {\n\t\t\tpq.add(new Node(entry.getKey(), entry.getValue()));\n\t\t}\n\n\t\t\/\/ do till there is more than one node in the queue\n\t\twhile (pq.size() != 1)\n\t\t{\n\t\t\t\/\/ Remove the two nodes of highest priority\n\t\t\t\/\/ (lowest frequency) from the queue\n\t\t\tNode left = pq.poll();\n\t\t\tNode right = pq.poll();\n\n\t\t\t\/\/ Create a new internal node with these two nodes as children \n\t\t\t\/\/ and with frequency equal to the sum of the two nodes\n\t\t\t\/\/ frequencies. Add the new node to the priority queue.\n\t\t\tint sum = left.freq + right.freq;\n\t\t\tpq.add(new Node('\u0000', sum, left, right));\n\t\t}\n\n\t\t\/\/ root stores pointer to root of Huffman Tree\n\t\tNode root = pq.peek();\n\n\t\t\/\/ traverse the Huffman tree and store the Huffman codes in a map\n\t\tMap&lt;Character, String&gt; huffmanCode = new HashMap&lt;&gt;();\n\t\tencode(root, &quot;&quot;, huffmanCode);\n\n\t\t\/\/ print the Huffman codes\n\t\tSystem.out.println(&quot;Huffman Codes are :n&quot;);\n\t\tfor (Map.Entry&lt;Character, String&gt; entry : huffmanCode.entrySet()) {\n\t\t\tSystem.out.println(entry.getKey() + &quot; &quot; + entry.getValue());\n\t\t}\n\n\t\tSystem.out.println(&quot;nOriginal string was :n&quot; + text);\n\n\t\t\/\/ print encoded string\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0 ; i &lt; text.length(); i++) {\n\t\t\tsb.append(huffmanCode.get(text.charAt(i)));\n\t\t}\n\n\t\tSystem.out.println(&quot;nEncoded string is :n&quot; + sb);\n\n\t\t\/\/ traverse the Huffman Tree again and this time\n\t\t\/\/ decode the encoded string\n\t\tint index = -1;\n\t\tSystem.out.println(&quot;nDecoded string is: n&quot;);\n\t\twhile (index &lt; sb.length() - 2) {\n\t\t\tindex = decode(root, index, sb);\n\t\t}\n\t}\n\n\tpublic static void main(String[] args)\n\t{\n\t\tString text = &quot;Huffman coding is a data compression algorithm.&quot;;\n\n\t\tbuildHuffmanTree(text);\n\t}\n}<\/code><\/pre>\n<p>\n<i>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/i> \u043f\u0430\u043c\u044f\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439, \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 47 * 8 = 376 \u0431\u0438\u0442, \u0430 \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0441\u0435\u0433\u043e 194 \u0431\u0438\u0442\u0430, \u0442.\u0435. \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0436\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 48%. \u0412 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043d\u0430 \u0421++ \u0432\u044b\u0448\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043b\u0430\u0441\u0441 string \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0439. <\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043e\u0432 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043d\u0430 \u0432\u0441\u0442\u0430\u0432\u043a\u0443 <i>O(log(N))<\/i> \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0430 \u0432 \u043f\u043e\u043b\u043d\u043e\u043c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u0435 \u0441 <i>N<\/i> \u043b\u0438\u0441\u0442\u044c\u044f\u043c\u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 <i>2N-1<\/i> \u0443\u0437\u043b\u043e\u0432, \u0438 \u0434\u0435\u0440\u0435\u0432\u043e \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430 \u2013 \u044d\u0442\u043e \u043f\u043e\u043b\u043d\u043e\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e, \u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0430 <i>O(Nlog(N))<\/i> \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0433\u0434\u0435 <i>N <\/i>\u2013 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432.<\/p>\n<h3>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438:<\/h3>\n<p>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/Huffman_coding\">en.wikipedia.org\/wiki\/Huffman_coding<\/a><\/noindex><br \/>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/Variable-length_code\">en.wikipedia.org\/wiki\/Variable-length_code<\/a><\/noindex><br \/>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/www.youtube.com\/watch?v=5wRPin4oxCo\">www.youtube.com\/watch?v=5wRPin4oxCo<\/a><\/noindex> <\/p>\n<p>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/otus.pw\/Hkvk\/\">\u0423\u0437\u043d\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043a\u0443\u0440\u0441\u0435.<br \/>\n<\/a><\/noindex><\/p>\n<p>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/497566\/\">habr.com<\/a> <\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0412 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 \u043a\u0443\u0440\u0441\u0430 \u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432\u00bb \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0434\u043b\u044f \u0432\u0430\u0441 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430. \u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430 \u2013 \u044d\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0436\u0430\u0442\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0438\u0434\u0435\u044e \u0441\u0436\u0430\u0442\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043a\u043e\u0434\u0430\u0445, \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445 \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430. \u041c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":78204,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-78203","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0412 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 \u043a\u0443\u0440\u0441\u0430 \u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432\u00bb \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0434\u043b\u044f \u0432\u0430\u0441 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430. \u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430 \u2013 \u044d\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0436\u0430\u0442\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0438\u0434\u0435\u044e \u0441\u0436\u0430\u0442\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043a\u043e\u0434\u0430\u0445, \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445 \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430. \u041c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/algoritm-szhatiya-haffmana\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"sq_AL\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0436\u0430\u0442\u0438\u044f \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430 | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0412 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 \u043a\u0443\u0440\u0441\u0430 \u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432\u00bb \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0434\u043b\u044f \u0432\u0430\u0441 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430. \u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430 \u2013 \u044d\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0436\u0430\u0442\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0438\u0434\u0435\u044e \u0441\u0436\u0430\u0442\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043a\u043e\u0434\u0430\u0445, \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445 \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430. \u041c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/algoritm-szhatiya-haffmana\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2020-04-17T11:42:42+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-04-17T11:42:42+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Algoritmi i kompresimit Huffman | ProHoster","description":"N\u00eb prag t\u00eb nisjes s\u00eb kursit 'Algoritmet p\u00ebr developer\u00ebt', kemi p\u00ebrgatitur p\u00ebr ju p\u00ebrkthimin e nj\u00eb materiali tjet\u00ebr t\u00eb dobish\u00ebm. Kodimi i Huffman-it \u00ebsht\u00eb nj\u00eb algorit\u00ebm kompresimi t\u00eb dh\u00ebnash, i cili formulon iden\u00eb kryesore t\u00eb kompresimit t\u00eb skedar\u00ebve. N\u00eb k\u00ebt\u00eb artikull do t\u00eb flasim p\u00ebr kodimin me gjat\u00ebsi fikse dhe t\u00eb ndryshueshme, kode unike dekodueshm\u00ebrie, rregullat e prefiksit dhe nd\u00ebrtimin e pem\u00ebs s\u00eb Huffman-it. Ne e dim\u00eb se \u00e7do simbol ruhet","canonical_url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/algoritm-szhatiya-haffmana","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"sq_AL","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0436\u0430\u0442\u0438\u044f \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430 | ProHoster","og:description":"\u0412 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 \u043a\u0443\u0440\u0441\u0430 \u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432\u00bb \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0434\u043b\u044f \u0432\u0430\u0441 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430. \u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430 \u2013 \u044d\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0436\u0430\u0442\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0438\u0434\u0435\u044e \u0441\u0436\u0430\u0442\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043a\u043e\u0434\u0430\u0445, \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445 \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430. \u041c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f","og:url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/algoritm-szhatiya-haffmana","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2020-04-17T11:42:42+00:00","article:modified_time":"2020-04-17T11:42:42+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"78203","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":null,"breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 17:03:32","updated":"2022-09-28 22:00:48"},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/78203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/comments?post=78203"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/78203\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media\/78204"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media?parent=78203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/categories?post=78203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/tags?post=78203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}