{"id":30529,"date":"2019-10-31T21:36:01","date_gmt":"2019-10-31T18:36:01","guid":{"rendered":"https:\/\/prohoster.info\/blog\/szhatie-dannyh-algoritmom-haffmana\/"},"modified":"2019-10-31T21:36:01","modified_gmt":"2019-10-31T18:36:01","slug":"szhatie-dannyh-algoritmom-haffmana","status":"publish","type":"post","link":"https:\/\/prohoster.info\/it\/blog\/administrirovanie\/szhatie-dannyh-algoritmom-haffmana","title":{"rendered":"Compressione dei dati con l'algoritmo di Huffman","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>\n\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0432 \u0441\u0436\u0430\u0442\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0430\u0440\u0445\u0438\u0432\u0430\u0442\u043e\u0440. \u041e\u0431 \u044d\u0442\u043e\u043c \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/144200\/\">\u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0425\u0430\u0431\u0440\u0435<\/a><\/noindex>, \u043d\u043e \u0431\u0435\u0437 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u0441\u0442\u0430 \u0432\u0437\u044f\u0442 \u0438\u0437 \u0448\u043a\u043e\u043b\u044c\u043d\u044b\u0445 \u0443\u0440\u043e\u043a\u043e\u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u043a\u0438 \u0438 \u043a\u043d\u0438\u0433\u0438 \u0420\u043e\u0431\u0435\u0440\u0442\u0430 \u041b\u0430\u0444\u043e\u0440\u0435 \u00abData Structures and Algorithms in Java\u00bb. \u0418\u0442\u0430\u043a, \u0432\u0441\u0435 \u043f\u043e\u0434 \u043a\u0430\u0442!<br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h2>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u044b\u0448\u043b\u0435\u043d\u0438\u0439<\/h2>\n<p>\n\u0412 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043e\u0434\u0438\u043d \u0441\u0438\u043c\u0432\u043e\u043b \u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442\u0441\u044f 8 \u0431\u0438\u0442\u0430\u043c\u0438(\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430 ASCII) \u0438\u043b\u0438 16(\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430 Unicode). \u0414\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0443 ASCII. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 s1 = \u00abSUSIE SAYS IT IS EASYn\u00bb. \u0412\u0441\u0435\u0433\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 22 \u0441\u0438\u043c\u0432\u043e\u043b\u0430, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0438 \u0441\u0438\u043c\u0432\u043e\u043b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u2014 &#8216;n&#8217;. \u0424\u0430\u0439\u043b, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0431\u0443\u0434\u0435\u0442 \u0432\u0435\u0441\u0438\u0442\u044c 22*8 = 176 \u0431\u0438\u0442. \u0421\u0440\u0430\u0437\u0443 \u0436\u0435 \u0432\u0441\u0442\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441: \u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 8 \u0431\u0438\u0442 \u0434\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438 1 \u0441\u0438\u043c\u0432\u043e\u043b\u0430? \u041c\u044b \u0432\u0435\u0434\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043d\u0435 \u0432\u0441\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438 ASCII. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0431\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438, \u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0435\u0439 \u0431\u044b\u043b\u043e \u0431\u044b \u0441\u0430\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0439 \u0431\u0443\u043a\u0432\u0435 \u2014 S \u2014 \u0434\u0430\u0442\u044c \u0441\u0430\u043c\u044b\u0439 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0439 \u043a\u043e\u0434, \u0430 \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0439 \u0440\u0435\u0434\u043a\u043e\u0439 \u0431\u0443\u043a\u0432\u0435 \u2014 T (\u0438\u043b\u0438 U, \u0438\u043b\u0438 &#8216;n&#8217;) \u2014 \u0434\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u043e\u0434\u043b\u0438\u043d\u043d\u0435\u0435. \u0412 \u044d\u0442\u043e\u043c \u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430: \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0439\u0442\u0438 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0444\u0430\u0439\u043b \u0431\u0443\u0434\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0435\u0441\u0430. \u0412\u043f\u043e\u043b\u043d\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u0447\u0442\u043e \u0443 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0434\u043b\u0438\u043d\u044b \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u2014 \u043d\u0430 \u044d\u0442\u043e\u043c \u0438 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. <\/p>\n<h3>\u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\n\u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0441\u0438\u043c\u0432\u043e\u043b\u0443 &#8216;S&#8217; \u043d\u0435 \u0434\u0430\u0442\u044c \u043a\u043e\u0434, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u0438\u043d\u043e\u0439 \u0432 1 \u0431\u0438\u0442: 0 \u0438\u043b\u0438 1. \u041f\u0443\u0441\u0442\u044c \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 1. \u0422\u043e\u0433\u0434\u0430 \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0435\u043c\u0443\u0441\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u0443 \u2014 &#8216; &#8216;(\u043f\u0440\u043e\u0431\u0435\u043b) \u2014 \u0434\u0430\u0434\u0438\u043c 0. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u0435\u0431\u0435, \u0432\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u2014 \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 s1 \u2014 \u0438 \u0432\u0438\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u043a\u043e\u0434 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 1. \u0418\u0442\u0430\u043a, \u0447\u0442\u043e \u0436\u0435 \u0434\u0435\u043b\u0430\u0442\u044c: \u044d\u0442\u043e \u0441\u0438\u043c\u0432\u043e\u043b S, \u0438\u043b\u0438 \u0436\u0435 \u044d\u0442\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 A? \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u0430\u0436\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e:<\/p>\n<p><b>\u041d\u0438 \u043e\u0434\u0438\u043d \u043a\u043e\u0434 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u0433\u043e<\/b><\/p>\n<p>\u042d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0447\u0430\u0441\u0442\u043e\u0442\u0430 (\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0439) \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430:<\/p>\n<p><img decoding=\"async\" alt=\"\u0421\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430\" src=\"\/wp-content\/uploads\/2019\/03\/3a2dbc8c7f636906061d1121ce87bb87.jpg\" style=\"display:block;margin: 0 auto;\" \/> \u0421\u0438\u043c\u0432\u043e\u043b\u044b \u0441 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0439 \u0434\u043e\u043b\u0436\u043d\u044b \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u043c <u>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c<\/u> \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0431\u0438\u0442\u043e\u0432. \u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u043a\u043e\u0434\u043e\u0432:<\/p>\n<p><img decoding=\"async\" alt=\"\u0421\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430\" src=\"\/wp-content\/uploads\/2019\/03\/5cbc5d1b81695b3adbfe697a88c85f64.jpg\" style=\"display:block;margin: 0 auto;\" \/> \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"plaintext\">10 01111 10 110 1111 00 10 010 1110 10 00 110 0110 00 110 10 00 1111 010 10 1110 01110<\/code><\/pre>\n<p>\n\u041a\u043e\u0434 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c. \u041f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u0432 \u0441\u0436\u0430\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442!<br \/>\n\u0412\u044b\u0442\u0435\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441: \u043a\u0430\u043a \u044d\u0442\u043e\u0442 \u0441\u0430\u043b\u0430\u0433\u0430 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b \u043a\u043e\u0434 \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043a\u043e\u0434\u043e\u0432? \u041e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c \u043d\u0438\u0436\u0435.<\/p>\n<h4>\u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0434\u0435\u0440\u0435\u0432\u0430 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430<\/h4>\n<p>\n\u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u043d\u0430 \u0432\u044b\u0440\u0443\u0447\u043a\u0443 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f \u043f\u043e\u0438\u0441\u043a\u0430. \u041d\u0435 \u0432\u043e\u043b\u043d\u0443\u0439\u0442\u0435\u0441\u044c, \u0437\u0434\u0435\u0441\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0438\u0441\u043a\u0430, \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f. \u0412\u043e\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0435\u0440\u0435\u0432\u0430 \u043d\u0430 java:<\/p>\n<pre><code class=\"java\">public class Node {\n    private int frequence;\n    private char letter;\n    private Node leftChild;\n    private Node rightChild;\n    ...\n}\n<\/code><\/pre>\n<p><\/p>\n<pre><code class=\"java\">class BinaryTree {\n    private Node root;\n\n    public BinaryTree() {\n        root = new Node();\n    }\n    public BinaryTree(Node root) {\n        this.root = root;\n    }\n    ...\n}\n<\/code><\/pre>\n<p>\n\u042d\u0442\u043e \u043d\u0435 \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434, \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u043d\u0438\u0436\u0435. <\/p>\n<p>\u0412\u043e\u0442 \u0441\u0430\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0434\u0435\u0440\u0435\u0432\u0430:<\/p>\n<ol>\n<li> \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 Node \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0438\u0437 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f(\u0441\u0442\u0440\u043e\u043a\u0430 s1). \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 9 \u0443\u0437\u043b\u043e\u0432(\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Node). \u041a\u0430\u0436\u0434\u044b\u0439 \u0443\u0437\u0435\u043b \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u043f\u043e\u043b\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445: \u0441\u0438\u043c\u0432\u043e\u043b \u0438 \u0447\u0430\u0441\u0442\u043e\u0442\u0430<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0414\u0435\u0440\u0435\u0432\u0430(BinaryTree) \u0434\u043b\u044f \u043a\u0430\u0436\u043b\u043e\u0433\u043e \u0438\u0437 \u0443\u0437\u043b\u043e\u0432 Node. \u0423\u0437\u0435\u043b \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043a\u043e\u0440\u043d\u0435\u043c \u0434\u0435\u0440\u0435\u0432\u0430. <\/li>\n<li>\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u0438 \u0434\u0435\u0440\u0435\u0432\u044c\u044f \u0432 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u0427\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0447\u0430\u0441\u0442\u043e\u0442\u0430, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0440\u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u0440\u0432\u043e \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439.<\/li>\n<\/ol>\n<p>\n\u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u043d\u043e \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ol>\n<li>\u0418\u0437\u0432\u043b\u0435\u0447\u044c \u0434\u0432\u0430 \u0434\u0435\u0440\u0435\u0432\u0430 \u0438\u0437 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u043e\u0439 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0445 \u043f\u043e\u0442\u043e\u043c\u043a\u0430\u043c\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0443\u0437\u043b\u0430 (\u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0443\u0437\u043b\u0430 \u0431\u0435\u0437 \u0431\u0443\u043a\u0432\u044b). \u0427\u0430\u0441\u0442\u043e\u0442\u0430 \u043d\u043e\u0432\u043e\u0433\u043e \u0443\u0437\u043b\u0430 \u0440\u0430\u0432\u043d\u0430 \u0441\u0443\u043c\u043c\u0435 \u0447\u0430\u0441\u0442\u043e\u0442 \u0434\u0432\u0443\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432-\u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432.<\/li>\n<li>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443\u0437\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0435\u0440\u0435\u0432\u043e \u0441 \u043a\u043e\u0440\u043d\u0435\u043c \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0443\u0437\u043b\u0435. \u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c. (\u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u0434\u0435\u0440\u0435\u0432\u0430 \u043d\u043e\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u0430, \u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043e\u043d\u0430 \u0432\u0441\u0442\u0430\u043d\u0435\u0442 \u043d\u0430 \u043d\u043e\u0432\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438)<\/li>\n<li>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0448\u0430\u0433\u043e\u0432 1 \u0438 2, \u043f\u043e\u043a\u0430 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u2014 \u0434\u0435\u0440\u0435\u0432\u043e \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430<\/li>\n<\/ol>\n<p>\n\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0435 s1:<\/p>\n<p><img decoding=\"async\" alt=\"\u0421\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430\" src=\"\/wp-content\/uploads\/2019\/03\/447914b5f3e792cdd11c9a10db296825.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\n\u0417\u0434\u0435\u0441\u044c \u0441\u0438\u043c\u0432\u043e\u043b \u00ablf\u00bb(linefeed) \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u00absp\u00bb (space) \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0431\u0435\u043b.<\/p>\n<h4>\u0410 \u0447\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435?<\/h4>\n<p>\n\u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u0435\u0440\u0435\u0432\u043e \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430. \u041d\u0443 \u043e\u043a\u0435\u0439. \u0418 \u0447\u0442\u043e \u0441 \u043d\u0438\u043c \u0434\u0435\u043b\u0430\u0442\u044c? \u0415\u0433\u043e \u0438 \u0437\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u043d\u0435 \u0432\u043e\u0437\u044c\u043c\u0443\u0442 \u0410 \u0434\u0430\u043b\u0435\u0435, \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u043e\u0442 \u043a\u043e\u0440\u043d\u044f \u0434\u043e \u043b\u0438\u0441\u0442\u043e\u0432 \u0434\u0435\u0440\u0435\u0432\u0430. \u0423\u0441\u043b\u043e\u0432\u0438\u043c\u0441\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0440\u0435\u0431\u0440\u043e 0, \u0435\u0441\u043b\u0438 \u043e\u043d\u043e \u0432\u0435\u0434\u0435\u0442 \u043a \u043b\u0435\u0432\u043e\u043c\u0443 \u043f\u043e\u0442\u043e\u043c\u043a\u0443 \u0438 1 \u2014 \u0435\u0441\u043b\u0438 \u043a \u043f\u0440\u0430\u0432\u043e\u043c\u0443. \u0421\u0442\u0440\u043e\u0433\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445, \u043a\u043e\u0434 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u2014 \u044d\u0442\u043e \u043f\u0443\u0442\u044c \u043e\u0442 \u043a\u043e\u0440\u043d\u044f \u0434\u0435\u0440\u0435\u0432\u0430 \u0434\u043e \u043b\u0438\u0441\u0442\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0433\u043e \u044d\u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b. <\/p>\n<p><img decoding=\"async\" alt=\"\u0421\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430\" src=\"\/wp-content\/uploads\/2019\/03\/8317385f4cf2fa87181bca4e370fb478.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\n\u0422\u0430\u043a\u0438\u043c \u043c\u0430\u043a\u0430\u0440\u043e\u043c \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043a\u043e\u0434\u043e\u0432. \u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u044d\u0442\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u043e \u00ab\u0432\u0435\u0441\u0435\u00bb \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u2014 \u044d\u0442\u043e \u0434\u043b\u0438\u043d\u0430 \u0435\u0433\u043e \u043a\u043e\u0434\u0430. \u0422\u043e\u0433\u0434\u0430 \u0432 \u0441\u0436\u0430\u0442\u043e\u043c \u0432\u0438\u0434\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0431\u0443\u0434\u0435\u0442 \u0432\u0435\u0441\u0438\u0442\u044c: 2 * 3 + 2*4 + 3 * 3 + 6 * 2 + 1 * 4 + 1 * 5 + 2 * 4 + 4 * 2 + 1 * 5 = 65 \u0431\u0438\u0442. \u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u043e\u043d \u0432\u0435\u0441\u0438\u043b 176 \u0431\u0438\u0442. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043c\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u0438 \u0435\u0433\u043e \u0430\u0436 \u0432 176\/65 = 2.7 \u0440\u0430\u0437\u0430! \u041d\u043e \u044d\u0442\u043e \u0443\u0442\u043e\u043f\u0438\u044f. \u0422\u0430\u043a\u043e\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0432\u0440\u044f\u0434 \u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d. \u041f\u043e\u0447\u0435\u043c\u0443? \u041e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<h3>\u0414\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\n\u041d\u0443, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u2014 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u042f \u0434\u0443\u043c\u0430\u044e, \u043c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437 \u0432\u0430\u0441 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0436\u0430\u0442\u044b\u0439 \u0444\u0430\u0439\u043b \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043d\u0430\u043c\u0435\u043a\u043e\u0432 \u043d\u0430 \u0442\u043e, \u043a\u0430\u043a \u043e\u043d \u0431\u044b\u043b \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d, \u043d\u0435\u043b\u044c\u0437\u044f \u2014 \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0435\u0433\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c! \u0414\u0430-\u0434\u0430, \u043c\u043d\u0435 \u0431\u044b\u043b\u043e \u0442\u044f\u0436\u0435\u043b\u043e \u044d\u0442\u043e \u043e\u0441\u043e\u0437\u043d\u0430\u0442\u044c, \u043d\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b table.txt \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0441\u0436\u0430\u0442\u0438\u044f:<\/p>\n<pre><code class=\"plaintext\">01110\n 00\nA010\nE1111\nI110\nS10\nT0110\nU01111\nY1110\n<\/code><\/pre>\n<p>\n\u0417\u0430\u043f\u0438\u0441\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0432\u0438\u0434\u0435 &#8216;\u0441\u0438\u043c\u0432\u043e\u043b&#8217;\u00ab\u043a\u043e\u0434 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u00bb. \u041f\u043e\u0447\u0435\u043c\u0443 01110 \u0431\u0435\u0437 \u0441\u0438\u043c\u0432\u043e\u043b\u0430? \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043e\u043d \u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c, \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 java, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u043c\u043d\u043e\u0439 \u043f\u0440\u0438 \u0432\u044b\u0432\u043e\u0434\u0435 \u0432 \u0444\u0430\u0439\u043b, \u0441\u0438\u043c\u0432\u043e\u043b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u2014 &#8216;n&#8217; -\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u044e\u0442 \u0432 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443(\u043a\u0430\u043a \u0431\u044b \u044d\u0442\u043e \u0433\u043b\u0443\u043f\u043e \u043d\u0435 \u0437\u0432\u0443\u0447\u0430\u043b\u043e). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u0432\u0435\u0440\u0445\u0443 \u0438 \u0435\u0441\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b \u0434\u043b\u044f \u043a\u043e\u0434\u0430 01110. \u0414\u043b\u044f \u043a\u043e\u0434\u0430 00 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u0435\u043b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438. \u0421\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u043d\u0430\u0448\u0435\u043c\u0443 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0443 \u0445\u0430\u043d\u0430\u044d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u0430\u043c\u044b\u0439 \u043d\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439. \u041d\u043e \u043e\u043d \u043f\u0440\u043e\u0441\u0442 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0421 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435\u043c \u0432\u044b\u0441\u043b\u0443\u0448\u0430\u044e \u0412\u0430\u0448\u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0418\u043c\u0435\u044f \u044d\u0442\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u043a\u0430\u043a\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u043e\u043c \u043c\u044b \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438\u0441\u044c, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438:<\/p>\n<p><b>\u041d\u0438 \u043e\u0434\u0438\u043d \u043a\u043e\u0434 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u0433\u043e<\/b><\/p>\n<p>\u0412\u043e\u0442 \u0442\u0443\u0442-\u0442\u043e \u043e\u043d\u043e \u0438 \u0438\u0433\u0440\u0430\u0435\u0442 \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u044e\u0449\u0443\u044e \u0440\u043e\u043b\u044c. \u041c\u044b \u0447\u0438\u0442\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u0438\u0442 \u0437\u0430 \u0431\u0438\u0442\u043e\u043c \u0438, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 d, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432, \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u043e\u0439, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0441\u0438\u043c\u0432\u043e\u043b\u0443 character, \u043c\u044b \u0441\u0440\u0430\u0437\u0443 \u0437\u043d\u0430\u0435\u043c \u0447\u0442\u043e \u0431\u044b\u043b \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d \u0441\u0438\u043c\u0432\u043e\u043b character (\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043d!). \u0414\u0430\u043b\u0435\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c character \u0432 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443(\u0441\u0442\u0440\u043e\u043a\u0443, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435), \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 d, \u0438 \u0447\u0438\u0442\u0430\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b.<\/p>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>\n\u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0443\u043d\u0438\u0436\u0430\u0442\u044c \u043c\u043e\u0439 \u043a\u043e\u0434 \u043f\u0438\u0441\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0432\u0430\u0442\u043e\u0440. \u041d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e Compressor.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043d\u0430\u0447\u0430\u043b\u0430. \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043f\u0438\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0441 Node:<\/p>\n<pre><code class=\"java\">public class Node {\n    private int frequence;\/\/\u0447\u0430\u0441\u0442\u043e\u0442\u0430\n    private char letter;\/\/\u0431\u0443\u043a\u0432\u0430\n    private Node leftChild;\/\/\u043b\u0435\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043c\u043e\u043a\n    private Node rightChild;\/\/\u043f\u0440\u0430\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043c\u043e\u043a\n\n   \n\n    public Node(char letter, int frequence) { \/\/\u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\n        this.letter = letter;\n        this.frequence = frequence;\n    }\n\n    public Node() {}\/\/\u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u0431\u0435\u0437\u044b\u043c\u044f\u043d\u043d\u044b\u0445 \u0443\u0437\u043b\u043e\u0432(\u0441\u043c. \u0432\u044b\u0448\u0435 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430)\n    public void addChild(Node newNode) {\/\/\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0442\u043e\u043c\u043a\u0430\n        if (leftChild == null)\/\/\u0435\u0441\u043b\u0438 \u043b\u0435\u0432\u044b\u0439 \u043f\u0443\u0441\u0442\u043e\u0439=&gt; \u043f\u0440\u0430\u0432\u044b\u0439 \u0442\u043e\u0436\u0435=&gt; \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043b\u0435\u0432\u044b\u0439\n            leftChild = newNode;\n        else {\n            if (leftChild.getFrequence() &lt;= newNode.getFrequence()) \/\/\u0432 \u043e\u0431\u0449\u0435\u043c, \u043b\u0435\u0432\u044b\u043c \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u043c\n                rightChild = newNode;\/\/\u0441\u0442\u0430\u043d\u0435\u0442 \u0442\u043e\u0442, \u0443 \u043a\u043e\u0433\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0447\u0430\u0441\u0442\u043e\u0442\u0430\n            else {\n                rightChild = leftChild;\n                leftChild = newNode;\n            }\n        }\n\n        frequence += newNode.getFrequence();\/\/\u0438\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u0430\n    }\n\n    public Node getLeftChild() {\n        return leftChild;\n    }\n\n    public Node getRightChild() {\n        return rightChild;\n    }\n\n    public int getFrequence() {\n        return frequence;\n    }\n\n    public char getLetter() {\n        return letter;\n    }\n\n    public boolean isLeaf() {\/\/\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043b\u0438\u0441\u0442\n        return leftChild == null &amp;&amp; rightChild == null;\n    }\n}\n<\/code><\/pre>\n<p>\n\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0435\u0440\u0435\u0432\u0446\u0435:<\/p>\n<pre><code class=\"java\">class BinaryTree {\n    private Node root;\n\n    public BinaryTree() {\n        root = new Node();\n    }\n\n    public BinaryTree(Node root) {\n        this.root = root;\n    }\n\n    public int getFrequence() {\n        return root.getFrequence();\n    }\n\n    public Node getRoot() {\n        return root;\n    }\n}\n<\/code><\/pre>\n<p>\n\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u0430\u044f \u043e\u0447\u0435\u0440\u0435\u0434\u044c:<\/p>\n<pre><code class=\"java\">import java.util.ArrayList;\/\/\u0434\u0430-\u0434\u0430, \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 \u0431\u0430\u0437\u0435 \u0441\u043f\u0438\u0441\u043a\u0430\n\nclass PriorityQueue {\n    private ArrayList&lt;BinaryTree&gt; data;\/\/\u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0447\u0435\u0440\u0435\u0434\u0438\n    private int nElems;\/\/\u043a\u043e\u043b-\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438\n\n    public PriorityQueue() {\n        data = new ArrayList&lt;BinaryTree&gt;();\n        nElems = 0;\n    }\n\n    public void insert(BinaryTree newTree) {\/\/\u0432\u0441\u0442\u0430\u0432\u043a\u0430\n        if (nElems == 0)\n            data.add(newTree);\n        else {\n            for (int i = 0; i &lt; nElems; i++) {\n                if (data.get(i).getFrequence() &gt; newTree.getFrequence()) {\/\/\u0435\u0441\u043b\u0438 \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u043c\u0435\u043d\u044c\u0448\u0435 \n                    data.add(i, newTree);\/\/\u0447\u0435\u043c \u0447\u0430\u0441\u0442. \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e, \u0442\u043e c\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0432\u0441\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f \u043d\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u044f\u0445 \u0441\u043f\u0440\u0430\u0432\u0430 \u043d\u0430 1 \u044f\u0447\u0435\u0439\u043a\u0443                   \n                    break;\/\/\u0437\u0430\u0442\u0435\u043c \u0441\u0442\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043d\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e\n                }\n                if (i == nElems - 1) \n                    data.add(newTree);\n            }\n        }\n        nElems++;\/\/\u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043b-\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 1\n    }\n\n    public BinaryTree remove() {\/\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438\n        BinaryTree tmp = data.get(0);\/\/\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\n        data.remove(0);\/\/\u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0443\u0434\u0430\u043b\u044f\u0435\u043c\n        nElems--;\/\/\u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u043c \u043a\u043e\u043b-\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 1\n        return tmp;\/\/\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442(\u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439)\n    }\n}\n<\/code><\/pre>\n<p>\n\u041a\u043b\u0430\u0441\u0441, \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0438\u0439 \u0434\u0435\u0440\u0435\u0432\u043e \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430:<\/p>\n<pre><code class=\"java\">public class HuffmanTree {\n    private final byte ENCODING_TABLE_SIZE = 127;\/\/\u0434\u043b\u0438\u043d\u0430 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b\n    private String myString;\/\/\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\n    private BinaryTree huffmanTree;\/\/\u0434\u0435\u0440\u0435\u0432\u043e \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430\n    private int[] freqArray;\/\/\u0447\u0430\u0441\u0442\u043e\u0442\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430\n    private String[] encodingArray;\/\/\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430\n\n\n    \/\/----------------constructor----------------------\n    public HuffmanTree(String newString) {\n        myString = newString;\n\n        freqArray = new int[ENCODING_TABLE_SIZE];\n        fillFrequenceArray();\n\n        huffmanTree = getHuffmanTree();\n\n        encodingArray = new String[ENCODING_TABLE_SIZE];\n        fillEncodingArray(huffmanTree.getRoot(), \"\", \"\");\n    }\n\n    \/\/--------------------frequence array------------------------\n    private void fillFrequenceArray() {\n        for (int i = 0; i &lt; myString.length(); i++) {\n            freqArray[(int)myString.charAt(i)]++;\n        }\n    }\n\n    public int[] getFrequenceArray() {\n        return freqArray;\n    }\n\n    \/\/------------------------huffman tree creation------------------\n    private BinaryTree getHuffmanTree() {\n        PriorityQueue pq = new PriorityQueue();\n        \/\/\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u043f\u0438\u0441\u0430\u043d \u0432\u044b\u0448\u0435\n        for (int i = 0; i &lt; ENCODING_TABLE_SIZE; i++) {\n            if (freqArray[i] != 0) {\/\/\u0435\u0441\u043b\u0438 \u0441\u0438\u043c\u0432\u043e\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435\n                Node newNode = new Node((char) i, freqArray[i]);\/\/\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0435\u0433\u043e Node\n                BinaryTree newTree = new BinaryTree(newNode);\/\/\u0430 \u0434\u043b\u044f Node \u0441\u043e\u0437\u0434\u0430\u0442\u044c BinaryTree\n                pq.insert(newTree);\/\/\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c\n            }\n        }\n\n        while (true) {\n            BinaryTree tree1 = pq.remove();\/\/\u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043f\u0435\u0440\u0432\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e.\n\n            try {\n                BinaryTree tree2 = pq.remove();\/\/\u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0432\u0442\u043e\u0440\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e\n\n                Node newNode = new Node();\/\/\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 Node\n                newNode.addChild(tree1.getRoot());\/\/\u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043c\u043a\u0430\u043c\u0438 \u0434\u0432\u0430 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u0435\u0440\u0435\u0432\u0430\n                newNode.addChild(tree2.getRoot());\n\n                pq.insert(new BinaryTree(newNode);\n            } catch (IndexOutOfBoundsException e) {\/\/\u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043e\u0434\u043d\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438\n                return tree1;\n            }\n        }\n    }\n\n    public BinaryTree getTree() {\n        return huffmanTree;\n    }\n\n    \/\/-------------------encoding array------------------\n    void fillEncodingArray(Node node, String codeBefore, String direction) {\/\/\u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443\n        if (node.isLeaf()) {\n            encodingArray[(int)node.getLetter()] = codeBefore + direction;\n        } else {\n            fillEncodingArray(node.getLeftChild(), codeBefore + direction, \"0\");\n            fillEncodingArray(node.getRightChild(), codeBefore + direction, \"1\");\n        }\n    }\n\n    String[] getEncodingArray() {\n        return encodingArray;\n    }\n\n    public void displayEncodingArray() {\/\/\u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438\n        fillEncodingArray(huffmanTree.getRoot(), \"\", \"\");\n\n        System.out.println(\"======================Encoding table====================\");\n        for (int i = 0; i &lt; ENCODING_TABLE_SIZE; i++) {\n            if (freqArray[i] != 0) {\n                System.out.print((char)i + \" \");\n                System.out.println(encodingArray[i]);\n            }\n        }\n        System.out.println(\"========================================================\");\n    }\n    \/\/-----------------------------------------------------\n    String getOriginalString() {\n        return myString;\n    }\n}\n<\/code><\/pre>\n<p>\n\u041a\u043b\u0430\u0441\u0441, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442\/\u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442:<\/p>\n<pre><code class=\"java\">public class HuffmanOperator {\n    private final byte ENCODING_TABLE_SIZE = 127;\/\/\u0434\u043b\u0438\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b\n    private HuffmanTree mainHuffmanTree;\/\/\u0434\u0435\u0440\u0435\u0432\u043e \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430 (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0441\u0436\u0430\u0442\u0438\u044f)\n    private String myString;\/\/\u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\n    private int[] freqArray;\/\/\u0447\u0430\u0441\u0442\u043e\u0442\u0430\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430\n    private String[] encodingArray;\/\/\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430\n    private double ratio;\/\/\u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0441\u0436\u0430\u0442\u0438\u044f \n\n\n    public HuffmanOperator(HuffmanTree MainHuffmanTree) {\/\/for compress\n        this.mainHuffmanTree = MainHuffmanTree;\n\n        myString = mainHuffmanTree.getOriginalString();\n\n        encodingArray = mainHuffmanTree.getEncodingArray();\n\n        freqArray = mainHuffmanTree.getFrequenceArray();\n    }\n\n    public HuffmanOperator() {}\/\/for extract;\n\n    \/\/---------------------------------------compression-----------------------------------------------------------\n    private String getCompressedString() {\n        String compressed = \"\";\n        String intermidiate = \"\";\/\/\u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430(\u0431\u0435\u0437 \u0434\u043e\u0431\u0430\u0432\u043e\u0447\u043d\u044b\u0445 \u043d\u0443\u043b\u0435\u0439)\n        \/\/System.out.println(\"=============================Compression=======================\");\n        \/\/displayEncodingArray();\n        for (int i = 0; i &lt; myString.length(); i++) {\n            intermidiate += encodingArray[myString.charAt(i)];\n        }\n        \/\/\u041c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u0438\u0442 \u0432 \u0444\u0430\u0439\u043b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043b\u0438\u043d\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043a\u0440\u0430\u0442\u043d\u043e\u0439 8=&gt;\n        \/\/\u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0443\u043b\u0438 \u0432 \u043a\u043e\u043d\u0435\u0446(\u043c\u043e\u0436\u043d\u043e 1, \u043d\u0435\u0442 \u0440\u0430\u0437\u043d\u0438\u0446\u044b)\n        byte counter = 0;\/\/\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043d\u0435\u0446 \u043d\u0443\u043b\u0435\u0439 (\u0431\u0430\u0439\u0442\u0430 \u0432 \u043f\u043e\u043b\u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u0442: 0&lt;=counter&lt;8&lt;127)\n        for (int length = intermidiate.length(), delta = 8 - length % 8; \n        \t\tcounter &lt; delta ; counter++) {\/\/delta - \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043d\u0443\u043b\u0435\u0439\n            intermidiate += \"0\";\n        }\n        \n        \/\/\u0441\u043a\u043b\u0435\u0438\u0442\u044c \u043a\u043e\u043b-\u0432\u043e \u0434\u043e\u0431\u0430\u0432\u043e\u0447\u043d\u044b\u0445 \u043d\u0443\u043b\u0435\u0439 \u0432 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u043c \u043f\u0440\u0435\u0434\u0430\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u0438 \u0438 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \n        compressed = String.format(\"%8s\", Integer.toBinaryString(counter &amp; 0xff)).replace(\" \", \"0\") + intermidiate;\n        \t\t\n        \/\/\u0438\u0434\u0435\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\n        setCompressionRatio();\n        \/\/System.out.println(\"===============================================================\");\n        return compressed;\n    }\n    \n    private void setCompressionRatio() {\/\/\u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0434\u0435\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \n        double sumA = 0, sumB = 0;\/\/A-the original sum\n        for (int i = 0; i &lt; ENCODING_TABLE_SIZE; i++) {\n            if (freqArray[i] != 0) {\n                sumA += 8 * freqArray[i];\n                sumB += encodingArray[i].length() * freqArray[i];\n            }\n        }\n        ratio = sumA \/ sumB;\n    }\n\n    public byte[] getBytedMsg() {\/\/final compression\n        StringBuilder compressedString = new StringBuilder(getCompressedString());\n        byte[] compressedBytes = new byte[compressedString.length() \/ 8];\n        for (int i = 0; i &lt; compressedBytes.length; i++) {\n                compressedBytes[i] = (byte) Integer.parseInt(compressedString.substring(i * 8, (i + 1) * 8), 2);\n        }\n        return compressedBytes;\n    }\n    \/\/---------------------------------------end of compression----------------------------------------------------------------\n    \/\/------------------------------------------------------------extract-----------------------------------------------------\n    public String extract(String compressed, String[] newEncodingArray) {\n        String decompressed = \"\";\n        String current = \"\";\n        String delta = \"\";\n        encodingArray = newEncodingArray;\n        \n        \/\/displayEncodingArray();\n        \/\/\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043b-\u0432\u043e \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043d\u0443\u043b\u0435\u0439\n        for (int i = 0; i &lt; 8; i++) \n        \tdelta += compressed.charAt(i);\n        int ADDED_ZEROES = Integer.parseInt(delta, 2);\n       \n        for (int i = 8, l = compressed.length() - ADDED_ZEROES; i &lt; l; i++) {\n            \/\/i = 8, \u0442.\u043a. \u043f\u0435\u0440\u0432\u044b\u043c \u0431\u0430\u0439\u0442\u043e\u043c \u0443 \u043d\u0430\u0441 \u0438\u0434\u0435\u0442 \u043a\u043e\u043b-\u0432\u043e \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043d\u0443\u043b\u0435\u0439\n            current += compressed.charAt(i);\n            for (int j = 0; j &lt; ENCODING_TABLE_SIZE; j++) {\n                if (current.equals(encodingArray[j])) {\/\/\u0435\u0441\u043b\u0438 \u0441\u043e\u0432\u043f\u0430\u043b\u043e\n                    decompressed += (char)j;\/\/\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\n                    current = \"\";\/\/\u0438 \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443\n                }\n            }\n        }\n\n        return decompressed;\n    }\n\n    public String getEncodingTable() {\n        String enc = \"\";\n    \tfor (int i = 0; i &lt; encodingArray.length; i++) {\n        \tif (freqArray[i] != 0) \n        \t\tenc += (char)i + encodingArray[i] + 'n';\n        }\n    \treturn enc;\n    }\n\n    public double getCompressionRatio() {\n        return ratio;\n    }\n\n\n    public void displayEncodingArray() {\/\/\u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438\n        System.out.println(\"======================Encoding table====================\");\n        for (int i = 0; i &lt; ENCODING_TABLE_SIZE; i++) {\n            \/\/if (freqArray[i] != 0) {\n                System.out.print((char)i + \" \");\n                System.out.println(encodingArray[i]);\n            \/\/}\n        }\n        System.out.println(\"========================================================\");\n    }\n    }\n<\/code><\/pre>\n<p>\n\u041a\u043b\u0430\u0441\u0441, \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"java\">import java.io.File;\nimport java.io.PrintWriter;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.Closeable;\n\npublic class FileOutputHelper implements Closeable {\n    private File outputFile;\n    private FileOutputStream fileOutputStream;\n\n    public FileOutputHelper(File file) throws FileNotFoundException {\n        outputFile = file;\n        fileOutputStream = new FileOutputStream(outputFile);\n    }\n\n    public void writeByte(byte msg) throws IOException {\n        fileOutputStream.write(msg);\n    }\n\n    public void writeBytes(byte[] msg) throws IOException {\n        fileOutputStream.write(msg);\n    }\n\n    public void writeString(String msg) {\n    \ttry (PrintWriter pw = new PrintWriter(outputFile)) {\n    \t\tpw.write(msg);\n    \t} catch (FileNotFoundException e) {\n    \t\tSystem.out.println(\"\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u043f\u0443\u0442\u044c, \u0438\u043b\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442!\");\n    \t}\n    }\n\n    @Override\n    public void close() throws IOException {\n        fileOutputStream.close();\n    }\n\n    public void finalize() throws IOException {\n        close();\n    }\n}\n<\/code><\/pre>\n<p>\n\u041a\u043b\u0430\u0441\u0441, \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u044e\u0449\u0438\u0439 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"java\">import java.io.FileInputStream;\nimport java.io.EOFException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.Closeable;\nimport java.io.File;\nimport java.io.IOException;\n\npublic class FileInputHelper implements Closeable {\n\tprivate FileInputStream fileInputStream;\n\tprivate BufferedReader fileBufferedReader;\n\t\n\tpublic FileInputHelper(File file) throws IOException {\n\t\tfileInputStream = new FileInputStream(file);\n\t\tfileBufferedReader = new BufferedReader(new InputStreamReader(fileInputStream));\n\t}\n\t\n\t\n    public byte readByte() throws IOException {\n    \tint cur = fileInputStream.read();\n    \tif (cur == -1)\/\/\u0435\u0441\u043b\u0438 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0441\u044f \u0444\u0430\u0439\u043b\n    \t\tthrow new EOFException();\n    \treturn (byte)cur;\n    }\n    \n    public String readLine() throws IOException {\n    \treturn fileBufferedReader.readLine();\n    }\n    \n    @Override\n    public void close() throws IOException{\n    \tfileInputStream.close();\n    }\n}\n<\/code><\/pre>\n<p>\n\u041d\u0443, \u0438 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441:<\/p>\n<pre><code class=\"java\">import java.io.File;\nimport java.nio.charset.MalformedInputException;\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio.file.NoSuchFileException;\nimport java.nio.file.Paths;\nimport java.util.List;\nimport java.io.EOFException;\npublic class Main {\n\tprivate static final byte ENCODING_TABLE_SIZE = 127;\n\t\n    public static void main(String[] args) throws IOException {\n        try {\/\/\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438\n            if (args[0].equals(\"--compress\") || args[0].equals(\"-c\"))\n                compress(args[1]);\n            else if ((args[0].equals(\"--extract\") || args[0].equals(\"-x\"))\n            \t\t&amp;&amp; (args[2].equals(\"--table\") || args[2].equals(\"-t\"))) {\n            \textract(args[1], args[3]);\n            }\n            else\n                throw new IllegalArgumentException();\n        } catch (ArrayIndexOutOfBoundsException | IllegalArgumentException e) {\n            System.out.println(\"\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \");\n            System.out.println(\"\u0427\u0438\u0442\u0430\u0439\u0442\u0435 Readme.txt\");\n            e.printStackTrace();\n        }\n    }\n\n\tpublic static void compress(String stringPath) throws IOException {\n        List&lt;String&gt; stringList;\n        File inputFile = new File(stringPath);\n        String s = \"\";\n        File compressedFile, table;\n        \n        try {\n            stringList = Files.readAllLines(Paths.get(inputFile.getAbsolutePath()));\n        } catch (NoSuchFileException e) {\n            System.out.println(\"\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u043f\u0443\u0442\u044c, \u0438\u043b\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442!\");\n            return;\n        } catch (MalformedInputException e) {\n        \tSystem.out.println(\"\u0422\u0435\u043a\u0443\u0449\u0430\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430 \u0444\u0430\u0439\u043b\u0430 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f\");\n        \treturn;\n        }\n\n        for (String item : stringList) {\n            s += item;\n            s += 'n';\n        }\n\n        HuffmanOperator operator = new HuffmanOperator(new HuffmanTree(s));\n\n        compressedFile = new File(inputFile.getAbsolutePath() + \".cpr\");\n        compressedFile.createNewFile();\n        try (FileOutputHelper fo = new FileOutputHelper(compressedFile)) {\n        \tfo.writeBytes(operator.getBytedMsg());\n        }\n        \/\/create file with encoding table:\n        \n        table = new File(inputFile.getAbsolutePath() + \".table.txt\");\n        table.createNewFile();\n        try (FileOutputHelper fo = new FileOutputHelper(table)) {\n        \tfo.writeString(operator.getEncodingTable());\n        }\n        \n        System.out.println(\"\u041f\u0443\u0442\u044c \u043a \u0441\u0436\u0430\u0442\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443: \" + compressedFile.getAbsolutePath());\n        System.out.println(\"\u041f\u0443\u0442\u044c \u043a \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \" + table.getAbsolutePath());\n        System.out.println(\"\u0411\u0435\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0444\u0430\u0439\u043b \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c!\");\n        \n        double idealRatio = Math.round(operator.getCompressionRatio() * 100) \/ (double) 100;\/\/\u0438\u0434\u0435\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\n        double realRatio = Math.round((double) inputFile.length() \n        \t\t\/ ((double) compressedFile.length() + (double) table.length()) * 100) \/ (double)100;\/\/\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\n        \n        System.out.println(\"\u0418\u0434\u0435\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0441\u0436\u0430\u0442\u0438\u044f \u0440\u0430\u0432\u0435\u043d \" + idealRatio);\n        System.out.println(\"\u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0441\u0436\u0430\u0442\u0438\u044f \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \" + realRatio);\n    }\n\n    public static void extract(String filePath, String tablePath) throws FileNotFoundException, IOException {\n        HuffmanOperator operator = new HuffmanOperator();\n        File compressedFile = new File(filePath),\n        \t tableFile = new File(tablePath),\n        \t extractedFile = new File(filePath + \".xtr\");\n        String compressed = \"\";\n        String[] encodingArray = new String[ENCODING_TABLE_SIZE];\n        \/\/read compressed file\n        \/\/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!check here:\n        try (FileInputHelper fi = new FileInputHelper(compressedFile)) {\n        \tbyte b;\n        \twhile (true) {\n        \t\tb = fi.readByte();\/\/method returns EOFException\n        \t\tcompressed += String.format(\"%8s\", Integer.toBinaryString(b &amp; 0xff)).replace(\" \", \"0\");\n        \t}\n        } catch (EOFException e) {\n        \t\n        }\n        \n        \/\/--------------------\n        \n        \/\/read encoding table:\n        try (FileInputHelper fi = new FileInputHelper(tableFile)) {\n        \tfi.readLine();\/\/skip first empty string\n        \tencodingArray[(byte)'n'] = fi.readLine();\/\/read code for 'n'\n        \twhile (true) {\n        \t\tString s = fi.readLine();\n        \t\tif (s == null)\n        \t\t\tthrow new EOFException();\n        \t\tencodingArray[(byte)s.charAt(0)] = s.substring(1, s.length());        \t\t\n        \t}\n        } catch (EOFException ignore) {}\n        \n        extractedFile.createNewFile();\n        \/\/extract:\n\t\ttry (FileOutputHelper fo = new FileOutputHelper(extractedFile)) {\n\t\t\tfo.writeString(operator.extract(compressed, encodingArray));\n\t\t}\n\t\t\n\t\tSystem.out.println(\"\u041f\u0443\u0442\u044c \u043a \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 \" + extractedFile.getAbsolutePath());\n    }\n}\n\n<\/code><\/pre>\n<p>\n\u0424\u0430\u0439\u043b \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438 readme.txt \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0432\u0430\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0430\u043c\u0438\u043c \ud83d\ude42<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\n\u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u044d\u0442\u043e \u0432\u0441\u0435 \u0447\u0442\u043e \u044f \u0445\u043e\u0442\u0435\u043b \u0441\u043a\u0430\u0437\u0430\u0442\u044c. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0447\u0442\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u043c\u043e\u0435\u0439 \u043d\u0435\u043a\u043e\u043c\u043f\u0435\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0439 \u0432 \u043a\u043e\u0434\u0435, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435, \u0432\u043e\u043e\u0431\u0449\u0435 \u043b\u044e\u0431\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0442\u043e \u0441\u043c\u0435\u043b\u043e \u043f\u0438\u0448\u0438\u0442\u0435. \u0415\u0441\u043b\u0438 \u044f \u0447\u0442\u043e-\u0442\u043e \u043d\u0435\u0434\u043e\u043e\u0431\u044a\u044f\u0441\u043d\u0438\u043b, \u0442\u043e\u0436\u0435 \u043f\u0438\u0448\u0438\u0442\u0435. \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u0443\u0441\u043b\u044b\u0448\u0430\u0442\u044c \u0432\u0430\u0441 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445!<\/p>\n<h3>P.S.<\/h3>\n<p>\n\u0414\u0430-\u0434\u0430, \u044f \u0432\u0441\u0435 \u0435\u0449\u0435 \u0437\u0434\u0435\u0441\u044c, \u0432\u0435\u0434\u044c \u044f \u043d\u0435 \u0437\u0430\u0431\u044b\u043b \u043f\u0440\u043e \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442. \u0414\u043b\u044f \u0441\u0442\u0440\u043e\u043a\u0438 s1 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0432\u0435\u0441\u0438\u0442 48 \u0431\u0430\u0439\u0442 \u2014 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u0434\u0430 \u0438 \u043f\u0440\u043e \u0434\u043e\u0431\u0430\u0432\u043e\u0447\u043d\u044b\u0435 \u043d\u0443\u043b\u0438 \u043d\u0435 \u0437\u0430\u0431\u044b\u043b\u0438(\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043d\u0443\u043b\u0435\u0439 \u0440\u0430\u0432\u043d\u043e 7)=&gt; \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0441\u0436\u0430\u0442\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u044b: 176\/(65 + 48*8 + 7)=0.38. \u0415\u0441\u043b\u0438 \u0432\u044b \u0442\u043e\u0436\u0435 \u044d\u0442\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u043f\u043e \u043b\u0438\u0446\u0443 \u0432\u044b \u043c\u043e\u043b\u043e\u0434\u0435\u0446. \u0414\u0430, \u044d\u0442\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0434\u043b\u044f \u043c\u0430\u043b\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432. \u041d\u043e \u0447\u0442\u043e \u0436\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438? \u0420\u0430\u0437\u043c\u0435\u0440\u044b \u0444\u0430\u0439\u043b\u0430 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u044e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0412\u043e\u0442 \u0437\u0434\u0435\u0441\u044c-\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a-\u043d\u0430\u0434\u043e! \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f<noindex><a rel=\"nofollow\" href=\"http:\/\/www.monologuearchive.com\/g\/goethe_001.html\"> \u043c\u043e\u043d\u043e\u043b\u043e\u0433\u0430 \u0424\u0430\u0443\u0441\u0442\u0430<\/a><\/noindex> \u0430\u0440\u0445\u0438\u0432\u0430\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 (\u043d\u0435 \u0438\u0434\u0435\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439) \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442, \u0440\u0430\u0432\u043d\u044b\u0439 1.46 \u2014 \u043f\u043e\u0447\u0442\u0438 \u0432 \u043f\u043e\u043b\u0442\u043e\u0440\u0430 \u0440\u0430\u0437\u0430! \u0418 \u0434\u0430, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0444\u0430\u0439\u043b \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435.<br \/>\n<br \/>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/438512\/\">habr.com<\/a><\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0432 \u0441\u0436\u0430\u0442\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0430\u0440\u0445\u0438\u0432\u0430\u0442\u043e\u0440. \u041e\u0431 \u044d\u0442\u043e\u043c \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0425\u0430\u0431\u0440\u0435, \u043d\u043e \u0431\u0435\u0437 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u0441\u0442\u0430 \u0432\u0437\u044f\u0442 \u0438\u0437 \u0448\u043a\u043e\u043b\u044c\u043d\u044b\u0445 \u0443\u0440\u043e\u043a\u043e\u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u043a\u0438 \u0438 \u043a\u043d\u0438\u0433\u0438 \u0420\u043e\u0431\u0435\u0440\u0442\u0430 \u041b\u0430\u0444\u043e\u0440\u0435 \u00abData Structures and Algorithms in Java\u00bb. \u0418\u0442\u0430\u043a, \u0432\u0441\u0435 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":22527,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-30529","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0432 \u0441\u0436\u0430\u0442\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0430\u0440\u0445\u0438\u0432\u0430\u0442\u043e\u0440. \u041e\u0431 \u044d\u0442\u043e\u043c \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0425\u0430\u0431\u0440\u0435, \u043d\u043e \u0431\u0435\u0437 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u0441\u0442\u0430 \u0432\u0437\u044f\u0442 \u0438\u0437 \u0448\u043a\u043e\u043b\u044c\u043d\u044b\u0445 \u0443\u0440\u043e\u043a\u043e\u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u043a\u0438 \u0438 \u043a\u043d\u0438\u0433\u0438 \u0420\u043e\u0431\u0435\u0440\u0442\u0430 \u041b\u0430\u0444\u043e\u0440\u0435 \u00abData Structures and Algorithms in Java\u00bb. \u0418\u0442\u0430\u043a, \u0432\u0441\u0435\" \/>\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\/it\/blog\/administrirovanie\/szhatie-dannyh-algoritmom-haffmana\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"it_IT\" \/>\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\u0421\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430 | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0432 \u0441\u0436\u0430\u0442\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0430\u0440\u0445\u0438\u0432\u0430\u0442\u043e\u0440. \u041e\u0431 \u044d\u0442\u043e\u043c \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0425\u0430\u0431\u0440\u0435, \u043d\u043e \u0431\u0435\u0437 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u0441\u0442\u0430 \u0432\u0437\u044f\u0442 \u0438\u0437 \u0448\u043a\u043e\u043b\u044c\u043d\u044b\u0445 \u0443\u0440\u043e\u043a\u043e\u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u043a\u0438 \u0438 \u043a\u043d\u0438\u0433\u0438 \u0420\u043e\u0431\u0435\u0440\u0442\u0430 \u041b\u0430\u0444\u043e\u0440\u0435 \u00abData Structures and Algorithms in Java\u00bb. \u0418\u0442\u0430\u043a, \u0432\u0441\u0435\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/it\/blog\/administrirovanie\/szhatie-dannyh-algoritmom-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=\"2019-10-31T18:36:01+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T18:36:01+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\udd47Compressione dei dati con l'algoritmo di Huffman | ProHoster","description":"Introduzione In questo articolo parler\u00f2 del noto algoritmo di Huffman e del suo utilizzo nella compressione dei dati. Alla fine, scriveremo un semplice compressore. Su questo tema c'era gi\u00e0 un articolo su Habr, ma senza implementazione pratica. Il materiale teorico di questo post proviene da lezioni di informatica scolastica e dal libro di Robert Lafore \"Strutture Dati e Algoritmi in Java\". Dunque, ecco tutto","canonical_url":"https:\/\/prohoster.info\/it\/blog\/administrirovanie\/szhatie-dannyh-algoritmom-haffmana","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"it_IT","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\u0421\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430 | ProHoster","og:description":"\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0432 \u0441\u0436\u0430\u0442\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0430\u0440\u0445\u0438\u0432\u0430\u0442\u043e\u0440. \u041e\u0431 \u044d\u0442\u043e\u043c \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0425\u0430\u0431\u0440\u0435, \u043d\u043e \u0431\u0435\u0437 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u0441\u0442\u0430 \u0432\u0437\u044f\u0442 \u0438\u0437 \u0448\u043a\u043e\u043b\u044c\u043d\u044b\u0445 \u0443\u0440\u043e\u043a\u043e\u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u043a\u0438 \u0438 \u043a\u043d\u0438\u0433\u0438 \u0420\u043e\u0431\u0435\u0440\u0442\u0430 \u041b\u0430\u0444\u043e\u0440\u0435 \u00abData Structures and Algorithms in Java\u00bb. \u0418\u0442\u0430\u043a, \u0432\u0441\u0435","og:url":"https:\/\/prohoster.info\/it\/blog\/administrirovanie\/szhatie-dannyh-algoritmom-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":"2019-10-31T18:36:01+00:00","article:modified_time":"2019-10-31T18:36:01+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"30529","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":"2026-01-21 01:39:20","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 03:33:27","updated":"2026-01-21 01:39:20","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/posts\/30529","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/comments?post=30529"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/posts\/30529\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/media\/22527"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/media?parent=30529"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/categories?post=30529"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/it\/wp-json\/wp\/v2\/tags?post=30529"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}