{"id":414819,"date":"2024-06-29T23:59:33","date_gmt":"2024-06-29T23:59:33","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=414819"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=414819","title":{"rendered":"<span>Algorithms in Go<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>Most solutions to algorithmic problems can be grouped into a rather small number of patterns. When we start to solve some problem, we need to think about how we would classify them. For example, can we apply\u00a0<code>fast and slow<\/code> \u0430lgorithmic pattern or do we need to use\u00a0<code>cyclic sort<\/code>pattern? Some of the problems have several solutions based on different patterns. In this series, we discuss the most popular algorithmic patterns that cover more than 90% of the usual problems.<\/p>\n<p>It is different from High-School Algorithms 101 Course, as it is not intended to cover things like Karatsuba algorithm (fast multiplication algorithm) or prove different methods of sorting. Instead, Algorithmic Patterns focused on practical skills needed for the solution of common problems. For example, when we set up a Prometheus alert for high request latency we are dealing with <a href=\"https:\/\/habr.com\/en\/post\/531444\/\" rel=\"noopener noreferrer nofollow\">Sliding Window Pattern<\/a>. Or let say, we organize a team event and need to find an available time slot for every participant. At the first glance, it is not obvious that in this case, we are actually solving an <a href=\"https:\/\/habr.com\/en\/post\/538888\/\" rel=\"noopener noreferrer nofollow\">algorithmic<\/a> problem. Actually, during our day we usually solve a bunch of algorithmic problems without realizing that we dealing with algorithms.<\/p>\n<p>The knowledge about Algorithmic Patterns helps one to classify a problem and then apply the appropriate method.<\/p>\n<p>But probably most importantly learning algorithmic patterns boost general programming skills. It is especially helpful when you are debugging some production code, as it trains you to understand the execution flow.<\/p>\n<p>Patterns covered so far:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/en\/post\/531444\/\" rel=\"noopener noreferrer nofollow\">Sliding Window I<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/en\/post\/532504\/\" rel=\"noopener noreferrer nofollow\">Sliding Window II<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/en\/post\/538888\/\" rel=\"noopener noreferrer nofollow\">Merge Intervals<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/en\/post\/541130\/\" rel=\"noopener noreferrer nofollow\">Dutch National Flag<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/en\/post\/543618\/\" rel=\"noopener noreferrer nofollow\">Matrix Spiral<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/en\/post\/545980\/\" rel=\"noopener noreferrer nofollow\">Iterative Postorder Traversal<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/en\/post\/551732\/\" rel=\"noopener noreferrer nofollow\">Bit Manipulation<\/a><\/p>\n<\/li>\n<\/ul>\n<p>Stay tuned \ud83d\ude42<\/p>\n<p>&lt;Promo> If you interested to work as a backend engineer, there is an open <a href=\"https:\/\/grnh.se\/c3e2b1b92us\" rel=\"noopener noreferrer nofollow\">position<\/a> in my squad. Prior knowledge of Golang is not required. I am NOT an HR and DO NOT represent the company in any capacity. However, I can share my personal experience as a backend engineer working in the company. &lt;\/Promo><\/p>\n<\/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\/articles\/545986\/\"> https:\/\/habr.com\/ru\/articles\/545986\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>Most solutions to algorithmic problems can be grouped into a rather small number of patterns. When we start to solve some problem, we need to think about how we would classify them. For example, can we apply\u00a0<code>fast and slow<\/code> \u0430lgorithmic pattern or do we need to use\u00a0<code>cyclic sort<\/code>pattern? Some of the problems have several solutions based on different patterns. In this series, we discuss the most popular algorithmic patterns that cover more than 90% of the usual problems.<\/p>\n<p>It is different from High-School Algorithms 101 Course, as it is not intended to cover things like Karatsuba algorithm (fast multiplication algorithm) or prove different methods of sorting. Instead, Algorithmic Patterns focused on practical skills needed for the solution of common problems. For example, when we set up a Prometheus alert for high request latency we are dealing with <a href=\"https:\/\/habr.com\/en\/post\/531444\/\" rel=\"noopener noreferrer nofollow\">Sliding Window Pattern<\/a>. Or let say, we organize a team event and need to find an available time slot for every participant. At the first glance, it is not obvious that in this case, we are actually solving an <a href=\"https:\/\/habr.com\/en\/post\/538888\/\" rel=\"noopener noreferrer nofollow\">algorithmic<\/a> problem. Actually, during our day we usually solve a bunch of algorithmic problems without realizing that we dealing with algorithms.<\/p>\n<p>The knowledge about Algorithmic Patterns helps one to classify a problem and then apply the appropriate method.<\/p>\n<p>But probably most importantly learning algorithmic patterns boost general programming skills. It is especially helpful when you are debugging some production code, as it trains you to understand the execution flow.<\/p>\n<p>Patterns covered so far:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/en\/post\/531444\/\" rel=\"noopener noreferrer nofollow\">Sliding Window I<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/en\/post\/532504\/\" rel=\"noopener noreferrer nofollow\">Sliding Window II<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/en\/post\/538888\/\" rel=\"noopener noreferrer nofollow\">Merge Intervals<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/en\/post\/541130\/\" rel=\"noopener noreferrer nofollow\">Dutch National Flag<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/en\/post\/543618\/\" rel=\"noopener noreferrer nofollow\">Matrix Spiral<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/en\/post\/545980\/\" rel=\"noopener noreferrer nofollow\">Iterative Postorder Traversal<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/en\/post\/551732\/\" rel=\"noopener noreferrer nofollow\">Bit Manipulation<\/a><\/p>\n<\/li>\n<\/ul>\n<p>Stay tuned \ud83d\ude42<\/p>\n<p>&lt;Promo> If you interested to work as a backend engineer, there is an open <a href=\"https:\/\/grnh.se\/c3e2b1b92us\" rel=\"noopener noreferrer nofollow\">position<\/a> in my squad. Prior knowledge of Golang is not required. I am NOT an HR and DO NOT represent the company in any capacity. However, I can share my personal experience as a backend engineer working in the company. &lt;\/Promo><\/p>\n<\/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\/articles\/545986\/\"> https:\/\/habr.com\/ru\/articles\/545986\/<\/a><br \/><\/br><\/br><\/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-414819","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/414819","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=414819"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/414819\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=414819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=414819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=414819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}