{"id":50467,"date":"2025-05-29T15:20:41","date_gmt":"2025-05-29T09:50:41","guid":{"rendered":"https:\/\/www.iquanta.in\/blog\/?p=50467"},"modified":"2025-05-29T15:20:42","modified_gmt":"2025-05-29T09:50:42","slug":"pigeonhole-sort-algorithm-its-complexity-and-working","status":"publish","type":"post","link":"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/","title":{"rendered":"Pigeonhole Sort Algorithm: Its Complexity and Working"},"content":{"rendered":"\n<p>Sorting means arranging things in order like putting your books by height or your clothes by color. In computer science sorting helps organize data to make it easier and faster to use. You may have heard of<a href=\"https:\/\/www.iquanta.in\/blog\/bubble-sort-algorithm-with-complexity-analysis\/\"> Bubble Sort<\/a>, Quick Sort or <a href=\"https:\/\/www.iquanta.in\/blog\/merge-sort-algorithm-with-complexity-analysis-working\/\">Merge Sort<\/a>. But have you ever heard of something called Pigeonhole Sort. It sounds funny but it is actually a real and clever way of sorting numbers.<\/p>\n\n\n\n<p>This blog will explain what Pigeonhole Sort is how it works and when to use it. Don&#8217;t worry we will keep it super simple We will also show you how fast or slow it is write a small Python program for it and share when it is a good choice or a bad one. If you are a student or someone just curious about sorting stuff using code this blog is for you. Let us jump into the world of Pigeonhole Sort.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/chat.whatsapp.com\/B6weknl7133BQXjPva0pgB\"><img fetchpriority=\"high\" decoding=\"async\" width=\"875\" height=\"142\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188.png\" alt=\"pigeonhole sort\" class=\"wp-image-50436\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188.png 875w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188-300x49.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188-768x125.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188-150x24.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188-696x113.png 696w\" sizes=\"(max-width: 875px) 100vw, 875px\" \/><\/a><\/figure><\/div>\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_77 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/#What_is_Pigeonhole_Sort_Algorithm\" >What is Pigeonhole Sort Algorithm?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/#How_Pigeonhole_Sort_Works\" >How Pigeonhole Sort Works?<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/#Step-by-Step_Process\" >Step-by-Step Process<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/#Time_and_Space_Complexity_of_Pigeonhole_Sort\" >Time and Space Complexity of Pigeonhole Sort<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/#Python_Code_for_Pigeonhole_Sort\" >Python Code for Pigeonhole Sort<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/#Advantages_of_Pigeonhole_Sort_Algorithm\" >Advantages of Pigeonhole Sort Algorithm<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/#Disadvantages_of_Pigeonhole_Sort_Algorithm\" >Disadvantages of Pigeonhole Sort Algorithm<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/#Frequently_Asked_Questions\" >Frequently Asked Questions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-what-is-pigeonhole-sort-algorithm\"><span class=\"ez-toc-section\" id=\"What_is_Pigeonhole_Sort_Algorithm\"><\/span><strong>What is Pigeonhole Sort Algorithm?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Pigeonhole Sort is a simple sorting technique that works best when the number of elements you want to sort is close to the number of possible values they can take. For example, if you are sorting the ages of students in a class and all ages are between 10 and 15, then Pigeonhole Sort can be super fast and efficient.<\/p>\n\n\n\n<p>It is based on a basic idea called the Pigeonhole Principle which says that if you have more pigeons than pigeonholes, at least one pigeonhole will have more than one pigeon. In sorting, this means putting each number into its right position or bucket based on its value just like how each pigeon goes into its own pigeonhole.<\/p>\n\n\n\n<p>The algorithm creates a list of empty buckets then puts each number into the correct bucket. After that it puts all the numbers back together in order.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/chat.whatsapp.com\/B6weknl7133BQXjPva0pgB\"><img fetchpriority=\"high\" decoding=\"async\" width=\"875\" height=\"142\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188.png\" alt=\"pigeonhole sort\" class=\"wp-image-50436\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188.png 875w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188-300x49.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188-768x125.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188-150x24.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188-696x113.png 696w\" sizes=\"(max-width: 875px) 100vw, 875px\" \/><\/a><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-pigeonhole-sort-works\"><span class=\"ez-toc-section\" id=\"How_Pigeonhole_Sort_Works\"><\/span><strong>How Pigeonhole Sort Works?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Pigeonhole Sort works in a few simple steps. It is all about placing elements into holes or buckets and then collecting them back in order. Here&#8217;s how it works step by step:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step-by-Step_Process\"><\/span><strong>Step-by-Step Process<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ol>\n<li>Find the minimum and maximum values in the array.<\/li>\n\n\n\n<li>Calculate the range by subtracting the minimum from the maximum and adding 1.<\/li>\n\n\n\n<li>Create empty buckets (also called pigeonholes) for each value in the range.<\/li>\n\n\n\n<li>Place each element in its appropriate bucket using its value.<\/li>\n\n\n\n<li>Go through the buckets one by one and collect the elements back in order.<\/li>\n<\/ol>\n\n\n\n<p>Let\u2019s understand this with a simple example.<\/p>\n\n\n\n<p>arr = [8, 3, 2, 7, 4, 6, 8]<\/p>\n\n\n\n<p>Bucket[0] \u2192 [2] (2 &#8211; 2 = 0)<br>Bucket[1] \u2192 [3] (3 &#8211; 2 = 1)<br>Bucket[2] \u2192 [4] (4 &#8211; 2 = 2)<br>Bucket[3] \u2192 []<br>Bucket[4] \u2192 [6] (6 &#8211; 2 = 4)<br>Bucket[5] \u2192 [7] (7 &#8211; 2 = 5)<br>Bucket[6] \u2192 [8, 8] (8 &#8211; 2 = 6)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-time-and-space-complexity-of-pigeonhole-sort\"><span class=\"ez-toc-section\" id=\"Time_and_Space_Complexity_of_Pigeonhole_Sort\"><\/span><strong>Time and Space Complexity of Pigeonhole Sort<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong>Case<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Time Complexity<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Explanation<\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Best Case<\/td><td class=\"has-text-align-center\" data-align=\"center\">O(n + Range)<\/td><td class=\"has-text-align-center\" data-align=\"center\">When the range of elements is small and elements are evenly distributed.<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Average Case<\/td><td class=\"has-text-align-center\" data-align=\"center\">O(n + Range)<\/td><td class=\"has-text-align-center\" data-align=\"center\">On average it still depends on both input size and value range.<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Worst Case<\/td><td class=\"has-text-align-center\" data-align=\"center\">O(n + Range)<\/td><td class=\"has-text-align-center\" data-align=\"center\">If the range is large then extra space and time is used for empty buckets.<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Space Complexity<\/td><td class=\"has-text-align-center\" data-align=\"center\">O(n + Range)<\/td><td class=\"has-text-align-center\" data-align=\"center\">Extra space is required to create buckets (pigeonholes).<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-python-code-for-pigeonhole-sort\"><span class=\"ez-toc-section\" id=\"Python_Code_for_Pigeonhole_Sort\"><\/span><strong>Python Code for Pigeonhole Sort<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Let\u2019s say you have a bunch of numbers and you want to sort them in order. Instead of comparing each number again and again like Bubble Sort, Pigeonhole Sort finds the smallest and biggest number first.<\/p>\n\n\n\n<p>Then it makes empty boxes (buckets) for all the numbers in between. Each number is placed in its matching box. Finally, it collects all the numbers from the boxes in order and gives you the sorted list. It\u2019s like sorting socks into drawers labeled with sizes and then pulling them out one by one in order.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def pigeonhole_sort(arr):\r\n    if not arr:\r\n        return arr\r\n\r\n    min_val = min(arr)\r\n    max_val = max(arr)\r\n    size = max_val - min_val + 1\r\n\r\n    holes = &#091;&#091;] for _ in range(size)]\r\n\r\n    for number in arr:\r\n        holes&#091;number - min_val].append(number)\r\n\r\n    i = 0\r\n    for hole in holes:\r\n        for number in hole:\r\n            arr&#091;i] = number\r\n            i += 1\r\n\r\n    return arr\r\n\r\narr = &#091;8, 3, 2, 7, 4, 6, 8]\r\nsorted_arr = pigeonhole_sort(arr)\r\nprint(\"Sorted array:\", sorted_arr)\r<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-advantages-of-pigeonhole-sort-algorithm\"><span class=\"ez-toc-section\" id=\"Advantages_of_Pigeonhole_Sort_Algorithm\"><\/span><strong>Advantages of Pigeonhole Sort Algorithm<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ol>\n<li>Pigeonhole Sort is very fast when the numbers you want to sort are close to each other.<\/li>\n\n\n\n<li>The idea is easy to understand because you just put numbers into buckets and then take them out in order.<\/li>\n\n\n\n<li>It does not need to compare numbers one by one like other sorting methods do.<\/li>\n\n\n\n<li>It keeps the original order of numbers that are the same, which is helpful sometimes.<\/li>\n\n\n\n<li>This method works best when you have a small range of numbers to sort.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/chat.whatsapp.com\/B6weknl7133BQXjPva0pgB\"><img fetchpriority=\"high\" decoding=\"async\" width=\"875\" height=\"142\" src=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188.png\" alt=\"pigeonhole sort\" class=\"wp-image-50436\" srcset=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188.png 875w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188-300x49.png 300w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188-768x125.png 768w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188-150x24.png 150w, https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/image-188-696x113.png 696w\" sizes=\"(max-width: 875px) 100vw, 875px\" \/><\/a><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-disadvantages-of-pigeonhole-sort-algorithm\"><span class=\"ez-toc-section\" id=\"Disadvantages_of_Pigeonhole_Sort_Algorithm\"><\/span><strong>Disadvantages of Pigeonhole Sort Algorithm<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ol>\n<li>Pigeonhole Sort uses a lot of extra space because it needs buckets for every number in the range.<\/li>\n\n\n\n<li>If the range of numbers is very large, it becomes slow and wastes memory.<\/li>\n\n\n\n<li>It is not good for sorting numbers that are spread out or very different from each other.<\/li>\n\n\n\n<li>The algorithm is not suitable for sorting things like strings or complex data easily.<\/li>\n\n\n\n<li>It can be less efficient than other sorting methods when the range of input values is much bigger than the number of items.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-frequently-asked-questions\"><span class=\"ez-toc-section\" id=\"Frequently_Asked_Questions\"><\/span><strong>Frequently Asked Questions<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong>Is Pigeonhole Sort a comparison-based sorting algorithm?<\/strong><br>No, Pigeonhole Sort is not comparison-based. It sorts by placing elements into buckets based on their values.<\/p>\n\n\n\n<p><strong>When should I use Pigeonhole Sort?<\/strong><br>Use it when you have numbers that are close together and the range of values is small.<\/p>\n\n\n\n<p><strong>Can Pigeonhole Sort handle negative numbers?<\/strong><br>Yes, it can handle negative numbers by adjusting the buckets based on the minimum value.<\/p>\n\n\n\n<p><strong>Is Pigeonhole Sort stable?<\/strong><br>Yes, it is stable if you insert elements in order into the buckets and collect them back properly.<\/p>\n\n\n\n<p><strong>How is Pigeonhole Sort different from Counting Sort?<\/strong><br>Both use buckets, but Counting Sort counts frequencies, while Pigeonhole Sort places elements directly into buckets.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Pigeonhole Sort is a cool and simple sorting method that works best when your numbers are close together and the range is small. It sorts by putting each number into its own bucket and then collecting them in order. While it is fast and easy to understand, it can use a lot of extra space if the range of numbers is big. So, it\u2019s not always the best choice for every sorting job. But if your data fits well, Pigeonhole Sort can save you time and effort. Now you know how it works, its pros and cons, and even how to code it in Python. Try it out and see for yourself.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sorting means arranging things in order like putting your books by height or your clothes by color. In computer science sorting helps organize data to make it easier and faster to use. You may have heard of Bubble Sort, Quick Sort or Merge Sort. But have you ever heard of something called Pigeonhole Sort. It [&hellip;]<\/p>\n","protected":false},"author":560,"featured_media":50519,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1075,1073],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.4 (Yoast SEO v21.9.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Pigeonhole Sort Algorithm: Its Complexity and Working - iQuanta<\/title>\n<meta name=\"description\" content=\"Learn how the Pigeonhole Sort algorithm works, its time complexity, advantages, limitations, and use cases with examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pigeonhole Sort Algorithm: Its Complexity and Working\" \/>\n<meta property=\"og:description\" content=\"Learn how the Pigeonhole Sort algorithm works, its time complexity, advantages, limitations, and use cases with examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/\" \/>\n<meta property=\"og:site_name\" content=\"iQuanta\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/iquanta.in\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-29T09:50:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-29T09:50:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/Your-paragraph-text-24.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1600\" \/>\n\t<meta property=\"og:image:height\" content=\"900\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Nidhi Goswami\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nidhi Goswami\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/\"},\"author\":{\"name\":\"Nidhi Goswami\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3\"},\"headline\":\"Pigeonhole Sort Algorithm: Its Complexity and Working\",\"datePublished\":\"2025-05-29T09:50:41+00:00\",\"dateModified\":\"2025-05-29T09:50:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/\"},\"wordCount\":1008,\"publisher\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#organization\"},\"articleSection\":[\"DSA and Competitive Programming\",\"iSkills\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/\",\"url\":\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/\",\"name\":\"Pigeonhole Sort Algorithm: Its Complexity and Working - iQuanta\",\"isPartOf\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#website\"},\"datePublished\":\"2025-05-29T09:50:41+00:00\",\"dateModified\":\"2025-05-29T09:50:42+00:00\",\"description\":\"Learn how the Pigeonhole Sort algorithm works, its time complexity, advantages, limitations, and use cases with examples.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.iquanta.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Pigeonhole Sort Algorithm: Its Complexity and Working\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#website\",\"url\":\"https:\/\/www.iquanta.in\/blog\/\",\"name\":\"iQuanta | Cat Preparation Online\",\"description\":\"Building Learning Networks\",\"publisher\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.iquanta.in\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#organization\",\"name\":\"IQuanta\",\"url\":\"https:\/\/www.iquanta.in\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2018\/08\/IQuanta-1.png\",\"contentUrl\":\"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2018\/08\/IQuanta-1.png\",\"width\":525,\"height\":200,\"caption\":\"IQuanta\"},\"image\":{\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/facebook.com\/iquanta.in\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3\",\"name\":\"Nidhi Goswami\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/21d234d87afd924b217d26b25a3cf1ee?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/21d234d87afd924b217d26b25a3cf1ee?s=96&d=mm&r=g\",\"caption\":\"Nidhi Goswami\"},\"url\":\"https:\/\/www.iquanta.in\/blog\/author\/nidhigoswami\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Pigeonhole Sort Algorithm: Its Complexity and Working - iQuanta","description":"Learn how the Pigeonhole Sort algorithm works, its time complexity, advantages, limitations, and use cases with examples.","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:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/","og_locale":"en_US","og_type":"article","og_title":"Pigeonhole Sort Algorithm: Its Complexity and Working","og_description":"Learn how the Pigeonhole Sort algorithm works, its time complexity, advantages, limitations, and use cases with examples.","og_url":"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/","og_site_name":"iQuanta","article_publisher":"https:\/\/facebook.com\/iquanta.in","article_published_time":"2025-05-29T09:50:41+00:00","article_modified_time":"2025-05-29T09:50:42+00:00","og_image":[{"width":1600,"height":900,"url":"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2025\/05\/Your-paragraph-text-24.jpg","type":"image\/jpeg"}],"author":"Nidhi Goswami","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Nidhi Goswami","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/#article","isPartOf":{"@id":"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/"},"author":{"name":"Nidhi Goswami","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3"},"headline":"Pigeonhole Sort Algorithm: Its Complexity and Working","datePublished":"2025-05-29T09:50:41+00:00","dateModified":"2025-05-29T09:50:42+00:00","mainEntityOfPage":{"@id":"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/"},"wordCount":1008,"publisher":{"@id":"https:\/\/www.iquanta.in\/blog\/#organization"},"articleSection":["DSA and Competitive Programming","iSkills"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/","url":"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/","name":"Pigeonhole Sort Algorithm: Its Complexity and Working - iQuanta","isPartOf":{"@id":"https:\/\/www.iquanta.in\/blog\/#website"},"datePublished":"2025-05-29T09:50:41+00:00","dateModified":"2025-05-29T09:50:42+00:00","description":"Learn how the Pigeonhole Sort algorithm works, its time complexity, advantages, limitations, and use cases with examples.","breadcrumb":{"@id":"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.iquanta.in\/blog\/pigeonhole-sort-algorithm-its-complexity-and-working\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.iquanta.in\/blog\/"},{"@type":"ListItem","position":2,"name":"Pigeonhole Sort Algorithm: Its Complexity and Working"}]},{"@type":"WebSite","@id":"https:\/\/www.iquanta.in\/blog\/#website","url":"https:\/\/www.iquanta.in\/blog\/","name":"iQuanta | Cat Preparation Online","description":"Building Learning Networks","publisher":{"@id":"https:\/\/www.iquanta.in\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.iquanta.in\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.iquanta.in\/blog\/#organization","name":"IQuanta","url":"https:\/\/www.iquanta.in\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2018\/08\/IQuanta-1.png","contentUrl":"https:\/\/www.iquanta.in\/blog\/wp-content\/uploads\/2018\/08\/IQuanta-1.png","width":525,"height":200,"caption":"IQuanta"},"image":{"@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/iquanta.in"]},{"@type":"Person","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/ec8c8c25d0526dd86557b6fed064f7f3","name":"Nidhi Goswami","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.iquanta.in\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/21d234d87afd924b217d26b25a3cf1ee?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/21d234d87afd924b217d26b25a3cf1ee?s=96&d=mm&r=g","caption":"Nidhi Goswami"},"url":"https:\/\/www.iquanta.in\/blog\/author\/nidhigoswami\/"}]}},"_links":{"self":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts\/50467"}],"collection":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/users\/560"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/comments?post=50467"}],"version-history":[{"count":6,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts\/50467\/revisions"}],"predecessor-version":[{"id":50517,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/posts\/50467\/revisions\/50517"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/media\/50519"}],"wp:attachment":[{"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/media?parent=50467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/categories?post=50467"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iquanta.in\/blog\/wp-json\/wp\/v2\/tags?post=50467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}