{"id":100,"date":"2024-12-26T14:35:09","date_gmt":"2024-12-26T19:35:09","guid":{"rendered":"https:\/\/kushaltimsina.com\/blog\/?p=100"},"modified":"2025-02-08T10:57:01","modified_gmt":"2025-02-08T15:57:01","slug":"merge-sort-explained-with-visuals","status":"publish","type":"post","link":"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/","title":{"rendered":"Merge Sort &#8211; Explained with Visuals"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>What is Merge Sort in One Sentence?<\/strong><\/h2>\n\n\n\n<p>Merge Sort is a computer science <a href=\"https:\/\/en.wikipedia.org\/wiki\/Sorting_algorithm\">sorting algorithm<\/a>, which essentially means that it takes a bunch of numbers and puts them in order.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What is an Example of Merge Sort?<\/strong><\/h2>\n\n\n\n<p>We&#8217;ll start with a worked example to illustrate what merge sort is all about.<\/p>\n\n\n\n<p>Let\u2019s say that I have 4 numbers.<\/p>\n\n\n\n<p>My numbers are (1, 41, 5, 0)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1522\" height=\"694\" src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image.png\" alt=\"Merge sort, illustrated with an example starting with the numbers (1, 41, 5, 0)\" class=\"wp-image-101\" srcset=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image.png 1522w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-300x137.png 300w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-1024x467.png 1024w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-768x350.png 768w\" sizes=\"auto, (max-width: 1522px) 100vw, 1522px\" \/><\/figure>\n\n\n\n<p>I want to sort these numbers out, so that they&#8217;re in increasing order.<\/p>\n\n\n\n<p>In Merge Sort, I take my numbers and I give half of them to my friends, Bob and John.<\/p>\n\n\n\n<p>So now, Bob has (1, 41) and John has (5, 0).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1476\" height=\"828\" src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-1.png\" alt=\"Merge sort starts by taking a bunch of numbers and splitting it into 2 different lists.\" class=\"wp-image-102\" srcset=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-1.png 1476w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-1-300x168.png 300w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-1-1024x574.png 1024w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-1-768x431.png 768w\" sizes=\"auto, (max-width: 1476px) 100vw, 1476px\" \/><\/figure>\n\n\n\n<p>And now, Bob asks himself: &#8220;Is 1 less than 41?&#8221; <\/p>\n\n\n\n<p>It is! <\/p>\n\n\n\n<p>So, 1 comes before 41.<\/p>\n\n\n\n<p>Therefore, Bob&#8217;s numbers have been sorted: (1, 41).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1638\" height=\"1044\" src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-2.png\" alt=\"From there, merge sort will sort each sublist.\" class=\"wp-image-103\" srcset=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-2.png 1638w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-2-300x191.png 300w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-2-1024x653.png 1024w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-2-768x489.png 768w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-2-1536x979.png 1536w\" sizes=\"auto, (max-width: 1638px) 100vw, 1638px\" \/><\/figure>\n\n\n\n<p>Now, it&#8217;s John&#8217;s turn.<\/p>\n\n\n\n<p>Does 5 come before 0? No! 0 comes before 5.<\/p>\n\n\n\n<p>So, John re-orders his numbers.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1622\" height=\"1052\" src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-3.png\" alt=\"\" class=\"wp-image-104\" srcset=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-3.png 1622w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-3-300x195.png 300w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-3-1024x664.png 1024w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-3-768x498.png 768w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-3-1536x996.png 1536w\" sizes=\"auto, (max-width: 1622px) 100vw, 1622px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Merge Sort &#8211; Returning Numbers Back<\/strong><\/h3>\n\n\n\n<p>And now, they both give their numbers back to Kushal.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1626\" height=\"1290\" src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-4.png\" alt=\"Merge sort sorts its two sublists and then returns it to the original caller.\" class=\"wp-image-105\" srcset=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-4.png 1626w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-4-300x238.png 300w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-4-1024x812.png 1024w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-4-768x609.png 768w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-4-1536x1219.png 1536w\" sizes=\"auto, (max-width: 1626px) 100vw, 1626px\" \/><\/figure>\n\n\n\n<p>And now, Kushal has to &#8220;merge&#8221; the (1, 41) and (0, 5) into a new sorted list.<\/p>\n\n\n\n<p>So, he points to the first item in both lists. <\/p>\n\n\n\n<p>Between the 1 and 0, what comes first? The 0 comes first. So, we add it to the list of sorted numbers.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1400\" height=\"438\" src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-6.png\" alt=\"We determine what comes first between 1 and 0.\" class=\"wp-image-107\" srcset=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-6.png 1400w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-6-300x94.png 300w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-6-1024x320.png 1024w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-6-768x240.png 768w\" sizes=\"auto, (max-width: 1400px) 100vw, 1400px\" \/><\/figure>\n\n\n\n<p>And now, we increment the arrow pointing to the 0. <\/p>\n\n\n\n<p>So now, the right arrow points to 5. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1494\" height=\"326\" src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-8.png\" alt=\"Merge sort then determines what comes first between 1 and 5.\" class=\"wp-image-109\" srcset=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-8.png 1494w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-8-300x65.png 300w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-8-1024x223.png 1024w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-8-768x168.png 768w\" sizes=\"auto, (max-width: 1494px) 100vw, 1494px\" \/><\/figure>\n\n\n\n<p>And we repeat. Between 1 and 5, 1 comes first. Add 1 to the sorted list and increment the arrow that points to 1. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1410\" height=\"774\" src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-7.png\" alt=\"Merge sort then determines what comes first between 1 and 5.\" class=\"wp-image-108\" srcset=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-7.png 1410w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-7-300x165.png 300w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-7-1024x562.png 1024w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-7-768x422.png 768w\" sizes=\"auto, (max-width: 1410px) 100vw, 1410px\" \/><\/figure>\n\n\n\n<p>Now, between 41 and 5, 5 comes first. Add 5 to the list and increment the arrow.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1342\" height=\"326\" src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-9.png\" alt=\"Merge sort then determines what comes first between 41 and 5.\" class=\"wp-image-110\" srcset=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-9.png 1342w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-9-300x73.png 300w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-9-1024x249.png 1024w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-9-768x187.png 768w\" sizes=\"auto, (max-width: 1342px) 100vw, 1342px\" \/><\/figure>\n\n\n\n<p>At this point, length of our sorted numbers is one less than the length of our unsorted numbers. This means that we have 1 more number to sort. <\/p>\n\n\n\n<p>And that is our last number, 41.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1080\" height=\"1920\" src=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-10.png\" alt=\"Merge Sort poster that provides an answer to &quot;What is merge sort?&quot;, courtesy of kushaltimsina.com\" class=\"wp-image-111\" srcset=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-10.png 1080w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-10-169x300.png 169w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-10-576x1024.png 576w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-10-768x1365.png 768w, https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-10-864x1536.png 864w\" sizes=\"auto, (max-width: 1080px) 100vw, 1080px\" \/><\/figure>\n\n\n\n<p>There you have it! Merge sort, clearly explained.<\/p>\n\n\n\n<p>If you&#8217;re a new computer science student, or are thinking about getting into computer science, check out <a href=\"https:\/\/kushaltimsina.com\/blog\/2025\/01\/15\/my-advice-for-new-students-in-computer-science\/\">my advice for new computer science students.<\/a><\/p>\n\n\n\n<p>Thanks for reading! If this helped you, make sure to subscribe to Kushal Writes for more awesome computer science concepts to level up your programming skills.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is Merge Sort in One Sentence? Merge Sort is a computer science sorting algorithm, which essentially means that it takes a bunch of numbers and puts them in order. What is an Example of Merge Sort? We&#8217;ll start with a worked example to illustrate what merge sort is all about. Let\u2019s say that I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":111,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[11,10,12],"class_list":["post-100","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-computer-science","tag-algorithms","tag-computer-science","tag-sorting-algorithms"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Merge Sort - Explained with Visuals - Kushal Writes<\/title>\n<meta name=\"description\" content=\"In this article, I explain merge sort, a computer science sorting algorithm, in a visually pleasing way. Merge sort is efficient at sorting.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Merge Sort - Explained with Visuals - Kushal Writes\" \/>\n<meta property=\"og:description\" content=\"In this article, I explain merge sort, a computer science sorting algorithm, in a visually pleasing way. Merge sort is efficient at sorting.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/\" \/>\n<meta property=\"og:site_name\" content=\"Kushal Writes\" \/>\n<meta property=\"article:published_time\" content=\"2024-12-26T19:35:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-08T15:57:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-10.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1080\" \/>\n\t<meta property=\"og:image:height\" content=\"1920\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"kushal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"kushal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/\"},\"author\":{\"name\":\"kushal\",\"@id\":\"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/9ae64ce30587c804d89b1eef21ba5d2f\"},\"headline\":\"Merge Sort &#8211; Explained with Visuals\",\"datePublished\":\"2024-12-26T19:35:09+00:00\",\"dateModified\":\"2025-02-08T15:57:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/\"},\"wordCount\":343,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/9ae64ce30587c804d89b1eef21ba5d2f\"},\"image\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-10.png\",\"keywords\":[\"algorithms\",\"computer science\",\"sorting algorithms\"],\"articleSection\":[\"Computer Science\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/\",\"url\":\"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/\",\"name\":\"Merge Sort - Explained with Visuals - Kushal Writes\",\"isPartOf\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-10.png\",\"datePublished\":\"2024-12-26T19:35:09+00:00\",\"dateModified\":\"2025-02-08T15:57:01+00:00\",\"description\":\"In this article, I explain merge sort, a computer science sorting algorithm, in a visually pleasing way. Merge sort is efficient at sorting.\",\"breadcrumb\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/#primaryimage\",\"url\":\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-10.png\",\"contentUrl\":\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-10.png\",\"width\":1080,\"height\":1920},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/kushaltimsina.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Merge Sort &#8211; Explained with Visuals\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/kushaltimsina.com\/blog\/#website\",\"url\":\"https:\/\/kushaltimsina.com\/blog\/\",\"name\":\"Kushal Timsina\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/9ae64ce30587c804d89b1eef21ba5d2f\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/kushaltimsina.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/9ae64ce30587c804d89b1eef21ba5d2f\",\"name\":\"kushal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/11\/tempImage75F1Sw-edited.jpg\",\"contentUrl\":\"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/11\/tempImage75F1Sw-edited.jpg\",\"width\":1274,\"height\":849,\"caption\":\"kushal\"},\"logo\":{\"@id\":\"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/image\/\"},\"description\":\"Kushal Timsina has been developing Roblox games since 2016, played 40,000,000+ times, teaches Roblox scripting on YouTube to 1,000,000+ views, and is the author of the Beginner's Guide to Roblox Scripting book.\",\"sameAs\":[\"https:\/\/kushaltimsina.com\/blog\"],\"url\":\"https:\/\/kushaltimsina.com\/blog\/author\/kushal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Merge Sort - Explained with Visuals - Kushal Writes","description":"In this article, I explain merge sort, a computer science sorting algorithm, in a visually pleasing way. Merge sort is efficient at sorting.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/","og_locale":"en_US","og_type":"article","og_title":"Merge Sort - Explained with Visuals - Kushal Writes","og_description":"In this article, I explain merge sort, a computer science sorting algorithm, in a visually pleasing way. Merge sort is efficient at sorting.","og_url":"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/","og_site_name":"Kushal Writes","article_published_time":"2024-12-26T19:35:09+00:00","article_modified_time":"2025-02-08T15:57:01+00:00","og_image":[{"width":1080,"height":1920,"url":"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-10.png","type":"image\/png"}],"author":"kushal","twitter_card":"summary_large_image","twitter_misc":{"Written by":"kushal","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/#article","isPartOf":{"@id":"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/"},"author":{"name":"kushal","@id":"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/9ae64ce30587c804d89b1eef21ba5d2f"},"headline":"Merge Sort &#8211; Explained with Visuals","datePublished":"2024-12-26T19:35:09+00:00","dateModified":"2025-02-08T15:57:01+00:00","mainEntityOfPage":{"@id":"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/"},"wordCount":343,"commentCount":0,"publisher":{"@id":"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/9ae64ce30587c804d89b1eef21ba5d2f"},"image":{"@id":"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/#primaryimage"},"thumbnailUrl":"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-10.png","keywords":["algorithms","computer science","sorting algorithms"],"articleSection":["Computer Science"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/","url":"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/","name":"Merge Sort - Explained with Visuals - Kushal Writes","isPartOf":{"@id":"https:\/\/kushaltimsina.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/#primaryimage"},"image":{"@id":"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/#primaryimage"},"thumbnailUrl":"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-10.png","datePublished":"2024-12-26T19:35:09+00:00","dateModified":"2025-02-08T15:57:01+00:00","description":"In this article, I explain merge sort, a computer science sorting algorithm, in a visually pleasing way. Merge sort is efficient at sorting.","breadcrumb":{"@id":"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/#primaryimage","url":"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-10.png","contentUrl":"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/12\/image-10.png","width":1080,"height":1920},{"@type":"BreadcrumbList","@id":"https:\/\/kushaltimsina.com\/blog\/2024\/12\/26\/merge-sort-explained-with-visuals\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kushaltimsina.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Merge Sort &#8211; Explained with Visuals"}]},{"@type":"WebSite","@id":"https:\/\/kushaltimsina.com\/blog\/#website","url":"https:\/\/kushaltimsina.com\/blog\/","name":"Kushal Timsina","description":"","publisher":{"@id":"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/9ae64ce30587c804d89b1eef21ba5d2f"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kushaltimsina.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/9ae64ce30587c804d89b1eef21ba5d2f","name":"kushal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/11\/tempImage75F1Sw-edited.jpg","contentUrl":"https:\/\/kushaltimsina.com\/blog\/wp-content\/uploads\/2024\/11\/tempImage75F1Sw-edited.jpg","width":1274,"height":849,"caption":"kushal"},"logo":{"@id":"https:\/\/kushaltimsina.com\/blog\/#\/schema\/person\/image\/"},"description":"Kushal Timsina has been developing Roblox games since 2016, played 40,000,000+ times, teaches Roblox scripting on YouTube to 1,000,000+ views, and is the author of the Beginner's Guide to Roblox Scripting book.","sameAs":["https:\/\/kushaltimsina.com\/blog"],"url":"https:\/\/kushaltimsina.com\/blog\/author\/kushal\/"}]}},"_links":{"self":[{"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/posts\/100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/comments?post=100"}],"version-history":[{"count":3,"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/posts\/100\/revisions"}],"predecessor-version":[{"id":387,"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/posts\/100\/revisions\/387"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/media\/111"}],"wp:attachment":[{"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/media?parent=100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/categories?post=100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kushaltimsina.com\/blog\/wp-json\/wp\/v2\/tags?post=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}