{"id":344138,"date":"2023-01-18T15:03:01","date_gmt":"2023-01-18T15:03:01","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=344138"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=344138","title":{"rendered":"<span>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c HyperLogLog, \u0438\u043b\u0438 \u041e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u043c \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0437\u0430 O(1)<\/span>"},"content":{"rendered":"<div><img loading=\"lazy\" decoding=\"async\" height=\"1\" src=\"https:\/\/vk.com\/rtrg?p=VK-RTRG-1288550-e6f1C\" width=\"1\" style=\"display: none;\"><img loading=\"lazy\" decoding=\"async\" height=\"1\" src=\"https:\/\/top-fwz1.mail.ru\/counter?id=3200881;js=na\" width=\"1\" style=\"display: none;\"><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/3g\/qm\/5y\/3gqm5ybvxrua2wfrq48gxzjxvm8.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/3g\/qm\/5y\/3gqm5ybvxrua2wfrq48gxzjxvm8.jpeg\" data-blurred=\"true\"\/><\/p>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u041c\u0430\u043a\u0441\u0438\u043c, \u044f \u0443\u0447\u0443\u0441\u044c \u043d\u0430 \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u043a\u0443\u0440\u0441\u0435 \u041c\u0424\u0422\u0418. \u042d\u0442\u0438\u043c \u043b\u0435\u0442\u043e\u043c \u044f \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0432 <a href=\"https:\/\/team.vk.company\/tarantoolforstudents\/\">\u0441\u0442\u0443\u0434\u0435\u043d\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435<\/a>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 Tarantool. \u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e, \u0441\u0443\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043b\u0438 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0440\u0435\u0448\u0438\u0442\u044c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0440\u043e\u043a.\u00a0<\/p>\n<p>  \u041c\u043e\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0431\u044b\u043b\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 HyperLogLog. \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u044f \u043d\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0440\u0443\u0441\u0441\u043a\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043c\u043d\u043e\u044e \u043e\u043f\u044b\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0443. \u0421\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u043b\u044e\u0434\u044f\u043c, \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u043c\u0441\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c\u0438 \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c. \u0414\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0442\u0435\u043c\u044b \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u0439, \u043d\u0438 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u0430 \u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c.\u00a0<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u0435\u0437\u0435\u043d HyperLogLog?<\/h2>\n<p>  \u0412 \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u0432 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0435 \u0447\u0438\u0441\u043b\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432\u0448\u0438\u0445 \u043f\u043e\u0441\u0442 \u0432 \u0441\u043e\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u0427\u0438\u0441\u043b\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u0440\u044c\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0435\u0434\u0438\u043d\u0438\u0446 \u0434\u043e \u0441\u043e\u0442\u0435\u043d \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432, \u0438 \u043e\u0431\u0430 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c.<\/p>\n<p>  \u041f\u043e\u0438\u0441\u043a \u0442\u043e\u0447\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u043d\u0430\u0448 \u0432\u043e\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043c\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u2014 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438\u043b\u0438 \u043f\u0430\u043c\u044f\u0442\u0438. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c HyperLogLog \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<p>  \u0423 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439:<\/p>\n<ul>\n<li>\u0422\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0438 \u043d\u0435 \u0441\u043d\u0438\u0436\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430<\/li>\n<li>\u041f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u0430. \u041e\u043d\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0430\u043b\u0430<\/li>\n<li>\u041d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430<\/li>\n<li>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445<\/li>\n<\/ul>\n<p>  <\/p>\n<h2>\u0418\u0434\u0435\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0430 \u043f\u0430\u043b\u044c\u0446\u0430\u0445<\/h2>\n<p>  \u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u0441 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0438\u0434\u0435\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b HyperLogLog. \u041a\u0430\u043a \u044f \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u0440\u0430\u043d\u0435\u0435, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e HyperLogLog \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430.\u00a0<\/p>\n<p>  \u0421\u0443\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f: \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0435\u0433\u043e \u0445\u0435\u0448 \u0438 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0432 \u043d\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0443\u043b\u0435\u0439, \u0438\u0434\u0443\u0449\u0438\u0445 \u043f\u043e\u0434\u0440\u044f\u0434.\u00a01\/2 \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0445\u0435\u0448\u0435\u0439 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 1, 1\/4 c 01, 1\/8 \u0441 001 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.\u00a0<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/zv\/sh\/bj\/zvshbjhkzxcyqj1k9rlte91ihfy.png\" data-src=\"https:\/\/habrastorage.org\/webt\/zv\/sh\/bj\/zvshbjhkzxcyqj1k9rlte91ihfy.png\"\/><\/div>\n<p>  \u041d\u0430\u0437\u043e\u0432\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0443\u043b\u0435\u0439, \u0438\u0434\u0443\u0449\u0438\u0445 \u043f\u043e\u0434\u0440\u044f\u0434 + 1 \u0440\u0430\u043d\u0433\u043e\u043c \u0445\u0435\u0448\u0430: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2eb\/6c1\/2ea\/2eb6c12ea713c7e722039ae91e82ecf8.svg\" alt=\"$rank(hash) = clz(hash) + 1$\" data-tex=\"inline\"\/>. \u0420\u0430\u043d\u0433 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u0435\u0442 \u0440\u0435\u0434\u043a\u043e\u0441\u0442\u044c \u0445\u0435\u0448\u0430. \u041b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b\u0438 \u00ab\u0440\u0435\u0434\u043a\u0438\u0439\u00bb \u0445\u0435\u0448, \u0442\u043e \u043d\u0430\u0448\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u2014 \u00ab\u0431\u043e\u043b\u044c\u0448\u043e\u0435\u00bb. \u0414\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u043b\u0438\u0448\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u043d\u0433 \u0432 \u043f\u043e\u0442\u043e\u043a\u0435.<\/p>\n<p>  \u0410 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0448\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0435? \u0412 \u0441\u0440\u0435\u0434\u043d\u0435\u043c, \u043d\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ff4\/27b\/bb4\/ff427bbb492742d537ee0de8457df4ef.svg\" alt=\"$2^n$\" data-tex=\"inline\"\/> \u0445\u0435\u0448\u0435\u0439 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0445\u0435\u0448 \u0441 \u0440\u0430\u043d\u0433\u043e\u043c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e7b\/aa1\/130\/e7baa113032f9d1ca1cb5ca054b310ed.svg\" alt=\"$n+1$\" data-tex=\"inline\"\/>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b96\/124\/857\/b961248571a62cd2068115bbb5eef08c.svg\" alt=\"$estimate = 2^{max \\: rank}$\" data-tex=\"inline\"\/>. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0433\u0440\u0443\u0431\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430. \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u0434\u0438\u043d \u0440\u0435\u0434\u043a\u0438\u0439 \u0445\u0435\u0448 \u0432 \u043f\u043e\u0442\u043e\u043a\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0441\u043a\u0430\u0437\u0438\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0443. \u041e\u0434\u043d\u0430\u043a\u043e \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0438\u0434\u0435\u044f \u0442\u0430\u043a\u0430\u044f, \u0435\u0435 \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u0438\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.<\/p>\n<p>  \u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/584\/3e0\/00a\/5843e000a2acea60b9122fd4c71427e7.svg\" alt=\"$2^{64}$\" data-tex=\"inline\"\/> \u0438\u043b\u0438 \u043c\u0435\u043d\u044c\u0448\u0435. \u0414\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0445\u0435\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c7b\/cc5\/cd0\/c7bcc5cd06c2b0b00d8e18595b1cc9f0.svg\" alt=\"$log_{2}2^{64} = 64 $\" data-tex=\"inline\"\/> \u0431\u0438\u0442. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u043d\u0433, \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/86b\/0ae\/ce6\/86b0aece6d8aa5146f0440623f69e7a5.svg\" alt=\"$log_{2}64 = 6$\" data-tex=\"inline\"\/> \u0431\u0438\u0442. \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9aa\/e08\/704\/9aae087046a60218262bab4a00522adc.svg\" alt=\"$N$\" data-tex=\"inline\"\/> \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/550\/418\/b36\/550418b362fe16a815f41b3f4c01ddac.svg\" alt=\"$log_{2}(log_{2}(N))$\" data-tex=\"inline\"\/> \u0431\u0438\u0442, \u044d\u0442\u0438\u043c \u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.<\/p>\n<h2>HyperLogLog<\/h2>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0435\u0434\u043a\u0438\u0445 \u0445\u0435\u0448\u0435\u0439 \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0442\u0438\u044f \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u043d\u0430 \u043f\u043e\u0434\u043f\u043e\u0442\u043e\u043a\u0438. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u043e\u0446\u0435\u043d\u043a\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043f\u043e\u0434\u043f\u043e\u0442\u043e\u043a\u043e\u0432. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u043e\u0433\u043e \u0440\u0435\u0434\u043a\u043e\u0433\u043e \u0445\u0435\u0448\u0430 \u043d\u0430 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u043d\u0438\u0436\u0430\u0435\u0442\u0441\u044f.\u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0435\u0434\u043a\u043e\u0433\u043e \u0445\u0435\u0448\u0430.<\/p>\n<p>  \u0412 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 HyperLogLog \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u043d\u0430 \u043f\u043e\u0434\u043f\u043e\u0442\u043e\u043a\u0438:<\/p>\n<ul>\n<li>\u041d\u043e\u043c\u0435\u0440 \u043f\u043e\u0434\u043f\u043e\u0442\u043e\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a7d\/f0b\/0cf\/a7df0b0cf52583a7326d63832fe3d4ed.svg\" alt=\"$p$\" data-tex=\"inline\"\/> \u0431\u0438\u0442\u0430\u043c\u0438 \u0445\u0435\u0448\u0430. \u042d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c.<\/li>\n<li>\u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0431\u0438\u0442 \u043c\u044b \u043e\u0442\u0434\u0430\u0434\u0438\u043c \u043f\u043e\u0434 \u0438\u043d\u0434\u0435\u043a\u0441 \u2014 \u0442\u0435\u043c \u0442\u043e\u0447\u043d\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0446\u0435\u043d\u043a\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a7d\/f0b\/0cf\/a7df0b0cf52583a7326d63832fe3d4ed.svg\" alt=\"$p$\" data-tex=\"inline\"\/> \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e.<\/li>\n<li>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u0438\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043c \u0440\u0430\u043d\u0433\u0430.<\/li>\n<\/ul>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/72\/h_\/k-\/72h_k-mkcvpbudkfevofe90-tko.png\" data-src=\"https:\/\/habrastorage.org\/webt\/72\/h_\/k-\/72h_k-mkcvpbudkfevofe90-tko.png\"\/><\/div>\n<p>  \u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0444\u043e\u0440\u043c\u0443\u043b\u0430\u043c\u0438:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/afb\/545\/0b2\/afb5450b28e12fab69462778abd2b12d.svg\" alt=\"$m = 2^{precision}$\" data-tex=\"display\"\/><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1cb\/d82\/1bd\/1cbd821bd173c17c5d12d83a37e0292c.svg\" alt=\"$standard \\: error &lt; \\frac{1,04}{\\sqrt{m}}$\" data-tex=\"display\"\/><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/354\/92f\/249\/35492f249206282a9bd5350cd46381d9.svg\" alt=\"$memory \\: usage = m \\times 6bit$\" data-tex=\"display\"\/><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/212\/5bf\/161\/2125bf161fd4d58d621e5cbadfcc54cf.svg\" alt=\"$estimate = \\alpha \\times \\left ( \\sum_{0}^{m-1} 2^{-rank_{i}}\\right )^{-1}$\" data-tex=\"display\"\/><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e5a\/590\/aac\/e5a590aac19b2a0e18cf8aceb7abfc09.svg\" alt=\"$\\alpha \\simeq 0,7m^{2} $\" data-tex=\"display\"\/><\/p>\n<p>  <strong>standard error<\/strong> \u2014 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438. \u0414\u043b\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u0432 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/cbc\/80a\/d23\/cbc80ad23cb8ba65a77894fee678e75d.svg\" alt=\"$1 \\%$\" data-tex=\"inline\"\/> \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0442\u0434\u0430\u0442\u044c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7bb\/8f1\/f52\/7bb8f1f52be2052c0ce3017944bab5ff.svg\" alt=\"$14$\" data-tex=\"inline\"\/> \u0431\u0438\u0442 \u043f\u043e\u0434 \u0438\u043d\u0434\u0435\u043a\u0441, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/413\/7d5\/9e1\/4137d59e1d3eafb1ec0a483c5c9ccb13.svg\" alt=\"$2^{14}=16384$\" data-tex=\"inline\"\/> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432.<\/p>\n<p>  <strong>memory usage<\/strong> \u2014 \u0445\u0440\u0430\u043d\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0cb\/e1e\/2f4\/0cbe1e2f42f5e6bea0caffa1997a24d8.svg\" alt=\"$m$\" data-tex=\"inline\"\/> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432, \u0438\u043d\u0434\u0435\u043a\u0441 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435, \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u043d\u0433\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8cf\/7b8\/119\/8cf7b8119bc29d02cf5ea5521ce34211.svg\" alt=\"$log_{2}(64 \u2014 precision) &lt; 6$\" data-tex=\"inline\"\/> \u0431\u0438\u0442. \u0414\u043b\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/cbc\/80a\/d23\/cbc80ad23cb8ba65a77894fee678e75d.svg\" alt=\"$1 \\%$\" data-tex=\"inline\"\/> \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8fa\/4b1\/9e2\/8fa4b19e2a531799f0bdd84136d7112a.svg\" alt=\"$12 288$\" data-tex=\"inline\"\/> \u0431\u0430\u0439\u0442.\u00a0<\/p>\n<p>  <strong>estimate<\/strong> \u2014 \u043e\u043f\u044f\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430, \u043d\u043e \u043f\u043e \u0441\u0443\u0442\u0438, \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441 \u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u043c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u043c.<\/p>\n<p>  \u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u043b\u0438, \u0447\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 1\/2 \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0445\u0435\u0448\u0435\u0439 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 1, 1\/4 c 01, 1\/8 \u0441 001 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041d\u043e \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u043e\u0441\u044c, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0439 \u0445\u0435\u0448 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0445\u0435\u0448\u0430 \u043e\u0442 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/502\/f96\/0ea\/502f960ea92bcba31646e66cccd41554.svg\" alt=\"$0$\" data-tex=\"inline\"\/> \u0434\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a18\/6e4\/53f\/a186e453febbc9274ef90552f841adf4.svg\" alt=\"$2^{64} \u2014 1$\" data-tex=\"inline\"\/> \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e, \u0444\u043e\u0440\u043c\u0443\u043b\u0430 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0441\u0442\u0430\u043d\u0435\u0442 \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0439.<\/p>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f, \u043d\u043e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 HyperLogLog \u043f\u0440\u0438\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430 \u0442\u0435\u043c, \u0447\u0442\u043e \u0435\u0439 \u043d\u0435 \u0441\u0442\u0440\u0430\u0448\u043d\u0430 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0441 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u043c\u0441\u044f \u0440\u0435\u0434\u043a\u0438\u043c \u0445\u0435\u0448\u0435\u043c \u0432 \u043f\u043e\u0442\u043e\u043a\u0435.<\/p>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u0445\u0435\u0448\u0438 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u2014 \u043f\u0435\u0440\u0432\u044b\u0439 \u0445\u0435\u0448 \u0438\u0434\u0435\u0442 \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0434\u043f\u043e\u0442\u043e\u043a, \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u0440\u0435\u0448\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0435\u0434\u043a\u043e\u0433\u043e \u0445\u0435\u0448\u0430 \u0432 \u043f\u043e\u0442\u043e\u043a\u0435. \u0410 \u0435\u0441\u043b\u0438 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u0441\u044f? \u0422\u043e\u0433\u0434\u0430 \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432\u043e \u0432\u0441\u0435 \u043f\u043e\u0434\u043f\u043e\u0442\u043e\u043a\u0438 \u0438 \u0438\u0441\u043f\u043e\u0440\u0442\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0435\u0437\u0434\u0435.\u00a0<\/p>\n<p>  \u0412 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 HyperLogLog \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0435\u0442, \u0432\u0441\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u044b\u00a0 \u0431\u0443\u0434\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0445\u0435\u0448, \u0437\u043d\u0430\u0447\u0438\u0442 \u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u043e\u043f\u0430\u0434\u0443\u0442 \u0432 \u043e\u0434\u0438\u043d \u043f\u043e\u0434\u043f\u043e\u0442\u043e\u043a.\u00a0<\/p>\n<p>  \u041f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0432\u0448\u0438\u0441\u044c \u0441 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0442\u0435\u043e\u0440\u0438\u0435\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<h2>Bias correction<\/h2>\n<p>  \u0412 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u043c\u0435\u043d\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0444\u043e\u0440\u043c\u0443\u043b\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2ae\/b72\/eeb\/2aeb72eebc65651a10f7c626dc54b9bf.svg\" alt=\"$memory \\: usage$\" data-tex=\"inline\"\/>. \u041d\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u044b <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2bd\/cd9\/549\/2bdcd9549730ed8826979e8a355aaf45.svg\" alt=\"$estimate$\" data-tex=\"inline\"\/> \u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/cd6\/daf\/cd9\/cd6dafcd95a95cf834850759c1aaf140.svg\" alt=\"$standard \\: error$\" data-tex=\"inline\"\/> \u0443\u0436\u0435 \u043d\u0435 \u043a\u0430\u0436\u0443\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c\u0438 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c\u0438. \u041c\u044b \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0444\u043e\u0440\u043c\u0443\u043b\u0443 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/cd6\/daf\/cd9\/cd6dafcd95a95cf834850759c1aaf140.svg\" alt=\"$standard \\: error$\" data-tex=\"inline\"\/> \u0434\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0430 \u0432\u043e\u0442 \u0444\u043e\u0440\u043c\u0443\u043b\u0443 \u043e\u0446\u0435\u043d\u043a\u0438 \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u0449\u0443\u043f\u0430\u0442\u044c \u0437\u0430\u0440\u0430\u043d\u0435\u0435.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0444\u043e\u0440\u043c\u0443\u043b\u0443 \u043e\u0446\u0435\u043d\u043a\u0438, \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u0442 \u0444\u0438\u0437\u0438\u043a\u0438: \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0441 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c \u043e\u0442\u0432\u0435\u0442\u043e\u043c. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0443\u0441\u0442\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u2014 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/502\/f96\/0ea\/502f960ea92bcba31646e66cccd41554.svg\" alt=\"$0$\" data-tex=\"inline\"\/>.\u00a0<\/p>\n<p>  \u0415\u0449\u0435 \u043d\u0438 \u043e\u0434\u0438\u043d \u0445\u0435\u0448 \u043d\u0435 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d, \u0437\u043d\u0430\u0447\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0440\u0430\u043d\u0433\u043e\u0432 \u0440\u0430\u0432\u043d\u044b <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/502\/f96\/0ea\/502f960ea92bcba31646e66cccd41554.svg\" alt=\"$0$\" data-tex=\"inline\"\/>, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0432 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u043e\u0446\u0435\u043d\u043a\u0438 \u0438\u043c\u0435\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0443\u043c\u043c\u0443 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d4a\/c7f\/4b6\/d4ac7f4b6821aecb794f61695d169e22.svg\" alt=\"$1$\" data-tex=\"inline\"\/> \u043e\u0442 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/502\/f96\/0ea\/502f960ea92bcba31646e66cccd41554.svg\" alt=\"$0$\" data-tex=\"inline\"\/> \u0434\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9e9\/e16\/216\/9e9e16216145fb6e9b12f8c851201d54.svg\" alt=\"$m \u2014 1$\" data-tex=\"inline\"\/>.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/fb3\/af3\/44f\/fb3af344f669824933be2404a0da50e3.svg\" alt=\"$estimate \\approx {\\frac{0,7 m^2}{m}}=0,7m = 183500$\" data-tex=\"inline\"\/>, \u0435\u0441\u043b\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/aa7\/f8c\/740\/aa7f8c740a90e7c1af50fea123a6fa18.svg\" alt=\"$precision = 18$\" data-tex=\"inline\"\/>. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043e\u0446\u0435\u043d\u043a\u0430 \u0434\u0430\u0436\u0435 \u043d\u0435 \u0431\u043b\u0438\u0437\u043a\u0430 \u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041d\u0435 \u0442\u0435\u0440\u044f\u044f \u043d\u0430\u0434\u0435\u0436\u0434\u044b, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0432\u0435\u0434\u0451\u0442 \u0441\u0435\u0431\u044f \u043e\u0446\u0435\u043d\u043a\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430:\u00a0<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/3r\/an\/mc\/3ranmcb9meywusgxla4s74ubjce.png\" data-src=\"https:\/\/habrastorage.org\/webt\/3r\/an\/mc\/3ranmcb9meywusgxla4s74ubjce.png\"\/><\/div>\n<p>  \u0418\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0438 \u043c\u0430\u043b\u044b\u0445 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044f\u0445, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435, \u043d\u043e \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044f\u0445 (<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ee9\/cd7\/271\/ee9cd7271f4bec6d708de140e58e1b59.svg\" alt=\"$\\approx1250000$\" data-tex=\"inline\"\/> \u0434\u043b\u044f <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/aa7\/f8c\/740\/aa7f8c740a90e7c1af50fea123a6fa18.svg\" alt=\"$precision = 18$\" data-tex=\"inline\"\/>) \u043e\u0446\u0435\u043d\u043a\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0441\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043a \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430. \u0422\u043e\u0447\u043a\u0430, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0446\u0435\u043d\u043a\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0441\u0445\u043e\u0434\u0438\u0442\u0441\u044f, \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u043a\u0430\u043a bias threshold \u0438 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u0435\u043d\u044c\u0448\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f9b\/d4d\/fe7\/f9bd4dfe73b21beca87f9096e7f5d9a2.svg\" alt=\"$5m$\" data-tex=\"inline\"\/>.<\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0442\u044c \u0433\u0440\u0430\u043d\u0438\u0446\u0443, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u0430\u0435\u0442 \u0442\u043e\u0447\u043d\u0443\u044e \u043e\u0446\u0435\u043d\u043a\u0443, \u0438 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u044d\u0442\u043e\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u044b. \u0412 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u044d\u0442\u043e \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u043e, \u043d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0431\u0443\u0434\u0435\u043c \u0447\u0435\u0441\u0442\u043d\u044b, \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e\u0435, \u0434\u0430\u0436\u0435 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435. \u042f \u0431\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0435\u043b \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u0438\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c, \u043f\u043e\u043a\u0430 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e.<\/p>\n<p>  \u0427\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c?<\/p>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u0430, \u043a\u0440\u0438\u0432\u0430\u044f \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0433\u043b\u0430\u0434\u043a\u0430\u044f. \u0417\u043d\u0430\u0447\u0438\u0442 \u043c\u043e\u0436\u043d\u043e \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/718\/5fa\/737\/7185fa7378fec7cd55b912f0ca3be495.svg\" alt=\"$bias(raw \\: estimate)$\" data-tex=\"inline\"\/> \u043a\u0430\u043a\u0438\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u043e\u043c. \u041d\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043f\u0440\u043e\u0449\u0435 \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5d3\/dfb\/113\/5d3dfb113229d8ec1ab052bdf3409b9b.svg\" alt=\"$cardinality(raw \\: estimate$\" data-tex=\"inline\"\/>), \u0430 \u0437\u0430\u0442\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u043a\u0440\u0438\u0432\u0443\u044e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043a\u0430\u043a <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f2c\/c5d\/48c\/f2cc5d48cef5e725e7c106f411991fa0.svg\" alt=\"$bias(raw \\: estimate) = raw \\: estimate \u2014 cardinality(raw \\: estimate)$\" data-tex=\"inline\"\/>. \u0412 \u0441\u0430\u043c\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u044b\u0440\u0443\u044e \u043e\u0446\u0435\u043d\u043a\u0443 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435 \u0438\u0437 \u0442\u0435\u043e\u0440\u0438\u0438 \u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 \u0441\u044b\u0440\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430 \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8a2\/14f\/a9a\/8a214fa9acbe09aecdcb13458c2715b2.svg\" alt=\"$bias \\: threshold$\" data-tex=\"inline\"\/>.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/q-\/rc\/9k\/q-rc9kj0sqhewmi5hk2morchbls.png\" data-src=\"https:\/\/habrastorage.org\/webt\/q-\/rc\/9k\/q-rc9kj0sqhewmi5hk2morchbls.png\"\/><\/div>\n<p>  \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0432 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u044e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0433\u0440\u0430\u0444\u0438\u043a:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/qz\/u3\/in\/qzu3in0hhuzbphtlqdgnracacwc.png\" data-src=\"https:\/\/habrastorage.org\/webt\/qz\/u3\/in\/qzu3in0hhuzbphtlqdgnracacwc.png\"\/><\/div>\n<p>  \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u043c\u044b \u0438\u0437\u0431\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u043e\u0442 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u043c\u0430\u043b\u044b\u0445 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044f\u0445, \u043d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0432\u0435\u0434\u0435\u0442 \u0441\u0435\u0431\u044f \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ec\/ez\/mp\/ecezmpgj7pbrgdcgsnyimqsksiu.png\" data-src=\"https:\/\/habrastorage.org\/webt\/ec\/ez\/mp\/ecezmpgj7pbrgdcgsnyimqsksiu.png\"\/><\/div>\n<p>  \u0418\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0438 \u043c\u0430\u043b\u044b\u0445 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044f\u0445 \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0448\u0435 \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u0439, \u043d\u043e \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0441\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u0441\u043c\u0435\u0441\u0442\u0438\u043b\u0430\u0441\u044c \u0432\u043b\u0435\u0432\u043e \u0438 \u0441\u0442\u0430\u043b\u0430 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e72\/cd2\/e65\/e72cd2e65682f4bf165a5663c77b51c4.svg\" alt=\"$500000 \\approx 2m$\" data-tex=\"inline\"\/>. \u042d\u0442\u043e, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e, \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435. \u041d\u043e \u043c\u044b \u043d\u0435 \u0440\u0435\u0448\u0438\u043b\u0438 \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043d\u0430\u043c \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430.<\/p>\n<p>  \u041d\u0435\u043f\u043b\u043e\u0445\u0430\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0430, \u043d\u043e \u044d\u0442\u043e \u0432\u0441\u0451 \u0435\u0449\u0451 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442, \u043a\u0430\u043a \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0443\u0437\u043a\u043e\u0433\u043e \u043a\u0440\u0443\u0433\u0430 \u0437\u0430\u0434\u0430\u0447.<\/p>\n<h2>LinearCounting<\/h2>\n<p>  \u0420\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c: LinearCounting. \u041a\u0440\u0430\u0442\u043a\u043e \u043e\u043f\u0438\u0448\u0443 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0440\u0430\u043d\u0434\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0443\u0441\u0442\u044c \u0438\u043c\u0435\u0435\u0442\u0441\u044f m \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0445\u0435\u0448 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043e\u0442 \u043d\u0435\u0433\u043e \u0445\u0435\u0448 \u0438 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0445\u0435\u0448 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432 \u043f\u043e\u0442\u043e\u043a\u0435. \u041f\u0443\u0441\u0442\u044c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/950\/169\/22b\/95016922b891e44487900fdc8c221910.svg\" alt=\"$m_{1}$\" data-tex=\"inline\"\/> \u2014 \u0447\u0438\u0441\u043b\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0445\u0435\u0448\u0435\u0439, \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u0432 \u043f\u043e\u0442\u043e\u043a\u0435, \u0442\u043e\u0433\u0434\u0430 \u043e\u0446\u0435\u043d\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2d2\/abb\/ffd\/2d2abbffd68fe3f9498328b74c73de6c.svg\" alt=\"$estimate = m \\times ln\\left ( \\frac{m}{(m - m_{1})} \\right )$\" data-tex=\"display\"\/><\/p>\n<p>  \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 HyperLogLog, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c LinearCounting \u0438\u043c\u0435\u0435\u0442 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u044d\u0442\u0430 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0448\u0435 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 HyperLogLog. \u0410 \u044d\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e \u0447\u0442\u043e \u043d\u0430\u043c \u0438 \u043d\u0443\u0436\u043d\u043e! \u041d\u043e \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0440\u0430\u0441\u0442\u0435\u0442 \u0438 \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c LinearCounting. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0445\u0435\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0438 \u0447\u0438\u0441\u043b\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0445\u0435\u0448\u0435\u0439, \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u0432 \u043f\u043e\u0442\u043e\u043a\u0435. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0445\u0435\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 (\u0438\u0445 \u0443 \u043d\u0430\u0441 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0cb\/e1e\/2f4\/0cbe1e2f42f5e6bea0caffa1997a24d8.svg\" alt=\"$m$\" data-tex=\"inline\"\/>), \u0430 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043b\u0438 \u0445\u0435\u0448 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0432 \u043f\u043e\u0442\u043e\u043a\u0435, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0440\u0430\u043d\u0433 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430. \u0415\u0441\u043b\u0438 \u043c\u044b \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u0438\u043d\u0434\u0435\u043a\u0441, \u0442\u043e \u0440\u0430\u043d\u0433 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u0435\u043d \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e 0, \u043d\u043e \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438, \u0435\u0433\u043e \u0440\u0430\u043d\u0433 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 1, \u0442\u0430\u043a \u043a\u0430\u043a <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5a4\/791\/ef5\/5a4791ef53c1d7ca6aef5e283a2415e4.svg\" alt=\"$rank = clz(hash) + 1 \\geq 0 + 1$\" data-tex=\"inline\"\/>.<\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0434\u0430\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0443, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c \u0440\u0430\u043d\u0433\u043e\u043c.<\/p>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u043c\u044b \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430, \u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c LinearCouning, \u0430 \u043a\u043e\u0433\u0434\u0430 HyperLogLog? \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u2014 \u043f\u043e\u043a\u0430 LinearCouning \u0442\u043e\u0447\u043d\u0435\u0435. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c LinearCouning \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0434\u043b\u044f \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c \u0435\u0435 \u044d\u043c\u043f\u0438\u0440\u0438\u0447\u0435\u0441\u043a\u0438: \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432. \u0410\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0438\u0440\u0443\u0435\u043c \u043a\u0440\u0438\u0432\u0443\u044e, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0443\u044e \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u0414\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0435\u043c \u0444\u0438\u0442\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u043e\u043c 4 \u0441\u0442\u0435\u043f\u0435\u043d\u0438. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c, \u0432 \u043a\u0430\u043a\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4ce\/441\/0e6\/4ce4410e6263d450d4d204699b71f408.svg\" alt=\"$E$\" data-tex=\"inline\"\/> \u0435\u0433\u043e \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 HyperLogLog. \u0422\u043e\u0433\u0434\u0430 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043e\u043a \u043c\u0435\u043d\u044c\u0448\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4ce\/441\/0e6\/4ce4410e6263d450d4d204699b71f408.svg\" alt=\"$E$\" data-tex=\"inline\"\/>, \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c LinearCouning, \u0430 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u2014 HyperLogLog.<\/p>\n<p>  \u0418\u0437\u043c\u0435\u0440\u0438\u0432 \u044d\u0442\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438, \u043c\u043e\u0433\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e, \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u043e\u0436\u043d\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0433\u0440\u0443\u0431\u043e \u043a\u0430\u043a <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/144\/0bd\/39b\/1440bd39b5b9b706a1ac77e02b7de715.svg\" alt=\"$2m$\" data-tex=\"inline\"\/>, \u044d\u0442\u043e \u044d\u043c\u043f\u0438\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0444\u0430\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u0434\u043b\u044f \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u0435\u0439:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ot\/n1\/jo\/otn1jooyoyzsbnko2gdy1ftggzm.png\" data-src=\"https:\/\/habrastorage.org\/webt\/ot\/n1\/jo\/otn1jooyoyzsbnko2gdy1ftggzm.png\"\/><\/div>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0448\u0435\u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0442\u0435\u0445\u043d\u0438\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u0446\u0435\u043d\u043a\u0438 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/f-\/xg\/wl\/f-xgwldjrxqznmzevwfuijekdlq.png\" data-src=\"https:\/\/habrastorage.org\/webt\/f-\/xg\/wl\/f-xgwldjrxqznmzevwfuijekdlq.png\"\/><\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0442\u0430\u043b \u043f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u043c. \u041c\u044b \u0438\u0437\u0431\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u043e\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043a \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0438 \u0434\u043e\u0431\u0438\u043b\u0438\u0441\u044c \u0434\u0430\u0436\u0435 \u043b\u0443\u0447\u0448\u0435\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043c\u0430\u043b\u044b\u0445 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p>  \u041d\u043e \u044d\u0442\u043e \u043d\u0430\u0441 \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442 \u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c.<\/p>\n<h2>Sparse representation<\/h2>\n<p>  \u041c\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430, \u043d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u0443\u043c\u0430\u0435\u043c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043c\u044b \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u043c. \u0415\u0441\u043b\u0438 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u043c\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432\u0441\u0435\u0433\u043e \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0442\u043e \u043c\u044b \u0435\u0433\u043e \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c, \u0438 \u043e\u0446\u0435\u043d\u043a\u0430, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0434\u0430\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c\u044e. \u041d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0439\u0442, \u0430 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u0430\u043b\u043b\u043e\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0442\u044b\u0441\u044f\u0447\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0441\u0442\u0438 \u0432 \u0441\u0435\u0431\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0445\u0435\u0448\u0435\u0439 \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0438\u043b\u043e\u0431\u0430\u0439\u0442\u044b \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>  \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0438\u0434\u0435\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0445\u0435\u0448\u0430\u0445. \u0412 \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0445\u0435\u0448\u0435\u0439. \u0420\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432. \u041f\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u043c \u0445\u0435\u0448\u0430\u043c \u043c\u044b \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0438\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u0438 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0443 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432, \u0435\u0441\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0445\u0435\u0448\u0435\u0439 \u0441\u0442\u0430\u043d\u0435\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043c. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0435 \u043c\u0430\u0441\u0441\u0438\u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043b\u043e\u0442\u043d\u044b\u043c, \u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0445\u0440\u0430\u043d\u044f\u0449\u0435\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0445\u0435\u0448\u0430\u0445 \u2014 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u043c.<\/p>\n<p>  \u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u044c 64-\u0431\u0438\u0442\u043d\u044b\u0439 \u0445\u0435\u0448, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u0443 \u0438\u0437 \u0440\u0430\u043d\u0433\u0430 \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0445\u0435\u0448\u0443 \u0438\u043d\u0434\u0435\u043a\u0441\u0430. \u0414\u043b\u044f \u0440\u0430\u043d\u0433\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e 6 \u0431\u0438\u0442, \u0430 \u0434\u043b\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0437\u044f\u0442\u044c \u0434\u0430\u0436\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0431\u0438\u0442, \u0447\u0435\u043c \u0442\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043d\u043e \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043f\u043e\u0434 \u0438\u043d\u0434\u0435\u043a\u0441 \u043e\u0442\u0434\u0430\u0434\u0438\u043c 26 \u0431\u0438\u0442. \u0422\u043e\u0433\u0434\u0430 \u043f\u0430\u0440\u0443 \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 32-\u0431\u0438\u0442\u043d\u043e\u043c \u0447\u0438\u0441\u043b\u0435, \u0438 \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443: \u0432 \u043f\u0435\u0440\u0432\u044b\u0445 26 \u0431\u0438\u0442\u0430\u0445 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0438\u043d\u0434\u0435\u043a\u0441, \u0430 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 6 \u2014 \u0440\u0430\u043d\u0433. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0430\u0440\u044b, \u043c\u044b \u0434\u043e\u0431\u044c\u0435\u043c\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u0438 \u0441\u0442\u0430\u043d\u0435\u043c \u044d\u043a\u043e\u043d\u043e\u043c\u043d\u0435\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c.<\/p>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0445\u0435\u0448\u0435\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0443\u0436\u0435 \u0438 \u043f\u043b\u043e\u0445\u043e\u0439 \u0438\u0434\u0435\u0435\u0439. \u0425\u043e\u0442\u044f \u0440\u0430\u0437\u043c\u0435\u0440 \u0445\u0435\u0448\u0430 \u0438 \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043f\u0430\u0440\u044b, \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043e\u0446\u0435\u043d\u043a\u0438 \u043f\u0440\u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u0445\u0435\u0448\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 HyperLogLog \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0432\u043d\u044b\u043c 64, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/017\/4a0\/28c\/0174a028c0a3371d77ae21b2e6a5aed2.svg\" alt=\"$error &lt; \\frac{1,04}{\\sqrt{2^{64}}} \\approx 2,4 \\times 10^{-10}$\" data-tex=\"inline\"\/>, \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0438 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0430\u0440 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3b0\/650\/549\/3b0650549a230544e4839a2c559ff7fd.svg\" alt=\"$\\frac{1,04}{\\sqrt{2^{26}}} \\approx 1,27 \\times 10^{-4}$\" data-tex=\"inline\"\/>, \u0447\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0438 \u043f\u043b\u043e\u0445\u043e.<\/p>\n<p>  \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0436\u0435 \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/104\/e35\/56f\/104e3556fdef4e9391df9da29825a0f4.svg\" alt=\"$m \\times \\frac{bitsize(register)}{bitsize(pair)} = m \\times \\frac{6}{32} &lt; m$\" data-tex=\"inline\"\/> \u043f\u0430\u0440, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 LinearCouning \u043f\u043e\u0440\u044f\u0434\u043a\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/144\/0bd\/39b\/1440bd39b5b9b706a1ac77e02b7de715.svg\" alt=\"$2m$\" data-tex=\"inline\"\/>, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0432 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c LinearCouning.<\/p>\n<p>  \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u0430: \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u043c \u0432 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043f\u0430\u0440\u044b. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043e\u0442 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a \u043f\u043b\u043e\u0442\u043d\u043e\u043c\u0443:<\/p>\n<p>  \u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u0430\u0440 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432. \u0414\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0438 \u0435\u0433\u043e \u0440\u0430\u043d\u0433. \u0420\u0430\u043d\u0433 \u0443\u0436\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043f\u0430\u0440\u0435, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441.<\/p>\n<p>  \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0435\u0440\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/855\/5ed\/420\/8555ed42026096095e3feda804157781.svg\" alt=\"$precision$\" data-tex=\"inline\"\/> \u0431\u0438\u0442 \u0432 \u0445\u0435\u0448\u0435. \u0412 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/260\/db2\/3ea\/260db23ea4f7ddbe6f4b433992ac1b75.svg\" alt=\"$precision = 26$\" data-tex=\"inline\"\/>, \u0437\u043d\u0430\u0447\u0438\u0442 \u0432 \u043f\u0430\u0440\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 26 \u0431\u0438\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0445\u0435\u0448\u0430. \u0415\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u044d\u0442\u043e\u0442 \u0436\u0435 \u0445\u0435\u0448, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u043b\u043e\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u043c\u044b \u0431\u044b \u0432\u0437\u044f\u043b\u0438 \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 18 \u0431\u0438\u0442 \u044d\u0442\u043e\u0433\u043e \u0445\u0435\u0448\u0430. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 18 \u0431\u0438\u0442 \u0445\u0435\u0448\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 26 \u0431\u0438\u0442\u0430\u0445 \u0445\u0435\u0448\u0430. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0442\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f7d\/05c\/e56\/f7d05ce56d4e324eef88fa83cad0a9f6.svg\" alt=\"$26 \u2014 precision$\" data-tex=\"inline\"\/> \u0431\u0438\u0442 \u0438\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u0430\u0440\u044b.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/io\/nj\/oo\/ionjooo4cvv4stth6wx79ah4ynu.png\" data-src=\"https:\/\/habrastorage.org\/webt\/io\/nj\/oo\/ionjooo4cvv4stth6wx79ah4ynu.png\"\/><\/div>\n<p>  \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0432 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0433\u0440\u0430\u0444\u0438\u043a \u0434\u043b\u044f \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.\u00a0<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/0x\/0g\/nk\/0x0gnkj4ka9wnzlxmi2tiqwpcus.png\" data-src=\"https:\/\/habrastorage.org\/webt\/0x\/0g\/nk\/0x0gnkj4ka9wnzlxmi2tiqwpcus.png\"\/><\/div>\n<p>  \u041a\u0430\u043a \u0438 \u043e\u0436\u0438\u0434\u0430\u043b\u043e\u0441\u044c, \u043e\u0446\u0435\u043d\u043a\u0438 \u043c\u0430\u043b\u044b\u0445 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u043c\u0438. \u041f\u043e\u0442\u043e\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f\u00a0 \u0440\u0435\u0437\u043a\u0438\u0439 \u0441\u043a\u0430\u0447\u043e\u043a, \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043e\u0442 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a \u043f\u043b\u043e\u0442\u043d\u043e\u043c\u0443, \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 LinearCounting.\u0422\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0438 \u0432\u0441\u0435 \u0435\u0449\u0435 \u0432\u044b\u0448\u0435 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 HyperLogLog, \u043d\u043e \u043e\u043d\u0430 \u0440\u0430\u0441\u0442\u0435\u0442 \u0438, \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0432 \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 HyperLogLog, \u043c\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c HyperLogLog c \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0435\u0439, \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u0438 \u0432 \u0447\u0438\u0441\u0442\u043e\u043c \u0432\u0438\u0434\u0435.<\/p>\n<p>  \u0416\u0435\u043b\u0430\u044e\u0449\u0438\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043c\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439: <a href=\"https:\/\/github.com\/KaitmazianMO\/TSoC-HyperLogLog\">github.com\/KaitmazianMO\/TSoC-HyperLogLog<\/a>.<\/p>\n<h2>\u041d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c\u0438<\/h2>\n<p>  \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432, \u043d\u0435 \u0442\u0435\u0440\u044f\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 A \u0438 B, \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e HyperLogLog \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/dc1\/e38\/00c\/dc1e3800c8aa8465e8f4e7fe2e49b054.svg\" alt=\"$HLL(A)$\" data-tex=\"inline\"\/> \u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3cf\/48c\/85c\/3cf48c85c02c4006987e4a4cfb0327ea.svg\" alt=\"$HLL(B)$\" data-tex=\"inline\"\/>. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u044d\u0442\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5bc\/412\/133\/5bc412133141ff85f0021ae93f950da5.svg\" alt=\"$HLL(A + B)$\" data-tex=\"inline\"\/>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u0438\u0445 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u0435\u0441\u0442\u0438 \u0441\u0435\u0431\u044f \u0440\u0430\u043d\u0433 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432, \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.\u00a0<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 A, \u0442\u043e\u0433\u0434\u0430 \u0440\u0430\u043d\u0433 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u0435\u043d \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0440\u0430\u043d\u0433\u0443 \u0432 \u044d\u0442\u043e\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u043c\u0443 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0443, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 B. \u0415\u0441\u043b\u0438 \u0436\u0435 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 A \u0438 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 B, \u0442\u043e\u0433\u0434\u0430 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u043d\u0433 \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0432\u0435\u043d \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0443 \u0438\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u0432 \u0434\u043b\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 A \u0438 B. \u0422\u043e \u0435\u0441\u0442\u044c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d2a\/fc4\/e83\/d2afc4e836478406f5f64e79d57b4e7b.svg\" alt=\"$rank_i(A + B) = max(rank_i(A), rank_i(B))$\" data-tex=\"inline\"\/>.<\/p>\n<p>  \u0417\u043d\u0430\u0447\u0438\u0442 \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5bc\/412\/133\/5bc412133141ff85f0021ae93f950da5.svg\" alt=\"$HLL(A + B)$\" data-tex=\"inline\"\/> \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0435\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u043d\u0433\u0438 \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 A \u0438 B. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0438 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 A \u0438 B.<\/p>\n<p>  \u0423\u043c\u0435\u044f \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1e9\/301\/495\/1e9301495791d00915281817c66f3014.svg\" alt=\"$A + B$\" data-tex=\"inline\"\/>, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ede\/dcd\/829\/ededcd82978a5a13eb4ddf084ad180c8.svg\" alt=\"$A \\: and \\: B$\" data-tex=\"inline\"\/>. \u0412 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0448\u043a\u043e\u043b\u044c\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0430: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8d2\/2e4\/1a2\/8d22e41a2380fd8304a64bd9c2215be7.svg\" alt=\"$\\left|A \\: and \\: B\\right| = \\left|A\\right| + \\left|B\\right| \u2014 \\left|A + B\\right|$\" data-tex=\"inline\"\/>. \u041d\u043e \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u044d\u0442\u043e\u043c\u0443 \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439, \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/519\/515\/c3f\/519515c3fa6e3e436d8780cc00227193.svg\" alt=\"$err(\\left|A \\: and \\: B\\right|) = err(\\left|A\\right|) + err(\\left|B\\right|) + err(\\left|A + B\\right|)$\" data-tex=\"inline\"\/>.<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/762\/dbf\/768\/762dbf768c8fea6b577e68bdaa0331b4.svg\" alt=\"$\\left|A \\setminus B\\right| = \\left|A + B\\right| \u2014 \\left|B\\right|$\" data-tex=\"inline\"\/>. \u041f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u0438 \u0441\u043d\u043e\u0432\u0430 \u0431\u0443\u0434\u0443\u0442 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c\u0441\u044f: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/53d\/004\/28f\/53d00428fa672c95db06083501a993b6.svg\" alt=\"$err(\\left|A \\setminus B\\right|) = err(\\left|A + B\\right|) + err(\\left|B\\right|)$\" data-tex=\"inline\"\/>.<\/p>\n<p>  \u0414\u043b\u044f \u0447\u0435\u0433\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e? \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c \u043f\u043e\u0438\u0441\u043a\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u043e\u0440\u0433\u043e\u0432\u0430\u044f \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u043e\u0432 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 4 <strong>\u0438\u043b\u0438<\/strong> 6 <strong>\u0438\u043b\u0438<\/strong> 8 \u044f\u0434\u0440\u0430\u043c\u0438, <strong>\u0438<\/strong> \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u043d\u0438\u0445 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 IPS \u043c\u0430\u0442\u0440\u0438\u0446\u0430 <strong>\u0438<\/strong> SSD \u0434\u0438\u0441\u043a. \u0415\u0441\u043b\u0438 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 HLL, \u044d\u0442\u043e \u043e\u0446\u0435\u043d\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0447\u0442\u0438 \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e, \u0437\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1d3\/22a\/3be\/1d322a3be07406f8801895deaf41407f.svg\" alt=\"$O(m) = O(1)$\" data-tex=\"inline\"\/>.<\/p>\n<p>  \u0414\u043b\u044f \u0443\u0433\u043b\u0443\u0431\u043b\u0435\u043d\u0438\u044f \u0432 \u0442\u0435\u043c\u0443 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043e\u043f\u0438\u0440\u0430\u043b\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430:\u00a0  <\/p>\n<ul>\n<li>Stefan Heule, Marc Nunkesser, Alexander Hall \u2014 <a href=\"https:\/\/static.googleusercontent.com\/media\/research.google.com\/ru\/\/pubs\/archive\/40671.pdf\">HyperLogLog in Practice: Algorithmic Engineering of a State of The Art Cardinality Estimation Algorithm<\/a>\u00a0<\/li>\n<li><a href=\"http:\/\/antirez.com\/news\/75\">Redis new data structure: the HyperLogLog<\/a>\u00a0<\/li>\n<\/ul>\n<p>  \u0421\u043a\u0430\u0447\u0430\u0442\u044c Tarantool \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/www.tarantool.io\/ru\/download?utm_source=habr&amp;utm_medium=articles&amp;utm_campaign=2021\">\u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435<\/a>, \u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u043c\u043e\u0449\u044c \u2014 <a href=\"https:\/\/t.me\/tarantoolru?utm_source=habr&amp;utm_medium=articles&amp;utm_campaign=2021\">\u0432 Telegram-\u0447\u0430\u0442\u0435<\/a>.<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/vk\/blog\/711126\/\"> https:\/\/habr.com\/ru\/company\/vk\/blog\/711126\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><img loading=\"lazy\" decoding=\"async\" height=\"1\" src=\"https:\/\/vk.com\/rtrg?p=VK-RTRG-1288550-e6f1C\" width=\"1\" style=\"display: none;\"><img loading=\"lazy\" decoding=\"async\" height=\"1\" src=\"https:\/\/top-fwz1.mail.ru\/counter?id=3200881;js=na\" width=\"1\" style=\"display: none;\"><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/3g\/qm\/5y\/3gqm5ybvxrua2wfrq48gxzjxvm8.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/3g\/qm\/5y\/3gqm5ybvxrua2wfrq48gxzjxvm8.jpeg\" data-blurred=\"true\"\/><\/p>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u041c\u0430\u043a\u0441\u0438\u043c, \u044f \u0443\u0447\u0443\u0441\u044c \u043d\u0430 \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u043a\u0443\u0440\u0441\u0435 \u041c\u0424\u0422\u0418. \u042d\u0442\u0438\u043c \u043b\u0435\u0442\u043e\u043c \u044f \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0432 <a href=\"https:\/\/team.vk.company\/tarantoolforstudents\/\">\u0441\u0442\u0443\u0434\u0435\u043d\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435<\/a>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 Tarantool. \u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e, \u0441\u0443\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043b\u0438 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0440\u0435\u0448\u0438\u0442\u044c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0440\u043e\u043a.\u00a0<\/p>\n<p>  \u041c\u043e\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0431\u044b\u043b\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 HyperLogLog. \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u044f \u043d\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0440\u0443\u0441\u0441\u043a\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043c\u043d\u043e\u044e \u043e\u043f\u044b\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0443. \u0421\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u043b\u044e\u0434\u044f\u043c, \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u043c\u0441\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c\u0438 \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c. \u0414\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0442\u0435\u043c\u044b \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u0439, \u043d\u0438 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u0430 \u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c.\u00a0  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-344138","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344138","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=344138"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344138\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=344138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=344138"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=344138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}