{"id":11500,"date":"2022-12-29T05:14:36","date_gmt":"2022-12-29T05:14:36","guid":{"rendered":"https:\/\/www.prepbytes.com\/blog\/?p=11500"},"modified":"2023-06-08T12:54:19","modified_gmt":"2023-06-08T12:54:19","slug":"radix-sort-program-in-c","status":"publish","type":"post","link":"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/","title":{"rendered":"Radix Sort Program in C"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006682-radix%20sort%20program%20in%20c.jpg\" alt=\"\" \/><\/p>\n<p>In this article, we will learn what is radix sort program in C, its algorithm, how it operates with a dry-run example, and how to implement a radix sort program in C with an example.<\/p>\n<h2>What is radix sort?<\/h2>\n<p>Radix sort is a linear sorting method that is exclusively used to sort arrays of the integer data type. The array is sorted in this algorithm digit by digit. The least significant digit to the most significant digit is sorted. Let&#8217;s use an example to illustrate which digit is the least important and which is the most important.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006749-radix%20sort%20program%20in%20c1.png\" alt=\"\" \/><\/p>\n<p>From the above picture, we will do a sorting from the last significant digit 4 to the most significant digit 7. Thus, in the first pass, we will sort all the elements of the array by the least significant array. After that, we will move toward the most significant digit, digit by digit, and sort the array. Now, let\u2019s see the algorithm of the radix sort.<\/p>\n<h2>Algorithm of the Radix sort:<\/h2>\n<p>Below is the algorithm for the Radix sort.<\/p>\n<pre><code>radix_sort(arr)  \nmax_element = largest element in the given array  \ndigits = number of digits in max_element  \nCreate total digit buckets of size 0 - 9  \nfor i -> 0 to digits  \nsort the array elements using counting sort (or any stable sort) according to the digits at the ith place  \n\nmain()\n    radix_sort(arr)<\/code><\/pre>\n<h2>Working of the Radix sort with dry-run:<\/h2>\n<p>Let\u2019s see how the Radix sort algorithm works using an example. First, we will see some steps to perform the Radix sort algorithm.<\/p>\n<ul>\n<li>Find the maximum element in the array and store it in max_element.<\/li>\n<li>Calculate the total digits in that max_element and store it in digits.<\/li>\n<li>Now we need to run through all the digits of max_elemnt.<\/li>\n<li>We will go through each digit from the least significant digit to the most significant digit and sort it.<\/li>\n<\/ul>\n<p>Now, let\u2019s see how the Radix sort algorithm works. We will take an example and do a dry run as well to understand the working of an algorithm.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006749-radix%20sort%20program%20in%20c2.png\" alt=\"\" \/><\/p>\n<p>We have taken an array of random integers. First, we will find the maximum element in the array which is 954. The maximum element 954 has 3 digits thus the loop will run 3 times and we have to go through 3 passes to sort an array. We will start from the least significant digit ( digit at place 0) to the most significant digit ( digit at place 2).<\/p>\n<p><strong>First Pass:<\/strong><br \/>\nIn the first pass, we will sort an array based on the least significant digit ( digit at 0th place).<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006755-radix%20sort%20program%20in%20c3.png\" alt=\"\" \/><\/p>\n<p>In the above picture, we can see that we have stored elements in another array of size 10 based on the least significant digit. After that, we will again transfer all the elements to the original array. Now, our array will look like this:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006755-radix%20sort%20program%20in%20c4.png\" alt=\"\" \/><\/p>\n<p>We will consider the above array for the second pass.<\/p>\n<p><strong>Second Pass:<\/strong><br \/>\nIn the second pass, we will sort an array based on the second least significant digit ( digit at 1st place ).<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006766-radix%20sort%20program%20in%20c5.png\" alt=\"\" \/><\/p>\n<p>In the above picture, we can see that we have stored elements in another array based on the second least significant digit ( digit at 1st place ). After that, we will again transfer all the elements to the original array. Now, our array will look like this:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006770-radix%20sort%20program%20in%20c6.png\" alt=\"\" \/><\/p>\n<p>We will consider the above array for the third pass.<\/p>\n<p><strong>Third Pass:<\/strong><br \/>\nIn the second pass, we will sort an array based on the most significant digit ( digit at 2nd place ).<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006770-radix%20sort%20program%20in%20c7.png\" alt=\"\" \/><\/p>\n<p>In the above picture, we can see that we have stored elements in another array based on the most significant digit ( digit at 2nd place ). After that, we will again transfer all the elements to the original array. Now, our array will look like this:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006774-radix%20sort%20program%20in%20c8.png\" alt=\"\" \/><\/p>\n<p>After the completion of the third pass, we can see that now our array is sorted.<\/p>\n<h2>C Program Code of Radix Sort<\/h2>\n<p>Now, we have a pretty good idea about how the radix sort algorithm works. Let\u2019s see how to write the radix sort program in c. We will use the counting sort method to implement the radix sort program in c. Counting sort means we will count the numbers having the same digit as the given position and we will store it accordingly. Now, we will write the radix sort program in c. <\/p>\n\t\t\t\t\t\t<style>\r\n\t\t\t\t\r\n\t\t\t\t\t#tab_container_11376 {\r\n\toverflow:hidden;\r\n\tdisplay:block;\r\n\twidth:100%;\r\n\tborder:0px solid #ddd;\r\n\tmargin-bottom:30px;\r\n\t}\r\n\r\n#tab_container_11376 .tab-content{\r\n\tpadding:20px;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n\tmargin-top: 0px;\r\n\tbackground-color:#ffffff !important;\r\n\tcolor: #000000 !important;\r\n\tfont-size:16px !important;\r\n\tfont-family: Open Sans !important;\r\n\t\r\n\t\tborder: 1px solid #e6e6e6 !important;\r\n\t}\r\n#tab_container_11376 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_11376 .wpsm_nav-tabs > li.active > a, #tab_container_11376 .wpsm_nav-tabs > li.active > a:hover, #tab_container_11376 .wpsm_nav-tabs > li.active > a:focus {\r\n\tcolor: #000000 !important;\r\n\tcursor: default;\r\n\tbackground-color: #ffffff !important;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n}\r\n\r\n#tab_container_11376 .wpsm_nav-tabs > li > a {\r\n    margin-right: 0px !important; \r\n    line-height: 1.42857143 !important;\r\n    border: 1px solid #d5d5d5 !important;\r\n    border-radius: 0px 0px 0 0 !important; \r\n\tbackground-color: #e8e8e8 !important;\r\n\tcolor: #000000 !important;\r\n\tpadding: 15px 18px 15px 18px !important;\r\n\ttext-decoration: none !important;\r\n\tfont-size: 14px !important;\r\n\ttext-align:center !important;\r\n\tfont-family: Open Sans !important;\r\n}\r\n#tab_container_11376 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_11376 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_11376 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_11376 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_11376 .wpsm_nav-tabs > li > a:hover , #tab_container_11376 .wpsm_nav-tabs > li > a:focus {\r\n    color: #000000 !important;\r\n    background-color: #e8e8e8 !important;\r\n\tborder: 1px solid #d5d5d5 !important;\r\n\t\r\n}\r\n#tab_container_11376 .wpsm_nav-tabs > li > a .fa{\r\n\r\nmargin-right:5px !important;\r\n\r\nmargin-left:5px !important;\r\n\r\n\r\n}\r\n\r\n\t\t#tab_container_11376 .wpsm_nav-tabs a{\r\n\t\t\tbackground-image: none;\r\n\t\t\tbackground-position: 0 0;\r\n\t\t\tbackground-repeat: repeat-x;\r\n\t\t}\r\n\t\t\t\r\n\r\n\r\n#tab_container_11376 .wpsm_nav-tabs > li {\r\n    float: left;\r\n    margin-bottom: -1px !important;\r\n\tmargin-right:0px !important; \r\n}\r\n\r\n\r\n#tab_container_11376 .tab-content{\r\noverflow:hidden !important;\r\n}\r\n\r\n\r\n@media (min-width: 769px) {\r\n\r\n\t#tab_container_11376 .wpsm_nav-tabs > li{\r\n\t\tfloat:left !important ;\r\n\t\t\t\tmargin-right:-1px !important;\r\n\t\t\t\t\t}\r\n\t#tab_container_11376 .wpsm_nav-tabs{\r\n\t\tfloat:none !important;\r\n\t\tmargin:0px !important;\r\n\t}\r\n\r\n\t#tab_container_11376 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_11376 .wpsm_nav{\r\n\t\t\t}\r\n\r\n}\r\n\r\n\r\n\r\n@media (max-width: 768px) {\r\n\t#tab_container_11376 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_11376 .wpsm_nav{\r\n\t\t\t}\r\n}\r\n\r\n\r\n\t.wpsm_nav-tabs li:before{\r\n\t\tdisplay:none !important;\r\n\t}\r\n\r\n\t@media (max-width: 768px) {\r\n\t\t\t\t\r\n\t\t\t\t.wpsm_nav-tabs{\r\n\t\t\tmargin-left:0px !important;\r\n\t\t\tmargin-right:0px !important; \r\n\t\t\t\r\n\t\t}\r\n\t\t\t\t#tab_container_11376 .wpsm_nav-tabs > li{\r\n\t\t\tfloat:none !important;\r\n\t\t}\r\n\t\t\t\r\n\t}\t\t\t\t<\/style>\r\n\t\t\t\t<div id=\"tab_container_11376\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_11376\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  class=\"active\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_11376_1\" aria-controls=\"tabs_desc_11376_1\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>C<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\t\t\t\t <\/ul>\r\n\r\n\t\t\t\t\t  <!-- Tab panes -->\r\n\t\t\t\t\t  <div class=\"tab-content\" id=\"tab-content_11376\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane  in active \" id=\"tabs_desc_11376_1\">\r\n\t\t\t\t\t\t\t\t<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">\/\/radix sort program in c\r\n\r\n#include &lt;stdio.h&gt;  \r\n\r\n\/\/ function to get maximum element from array  \r\nint find_max(int arr[], int n) {  \r\n   int max_element = arr[0];  \r\n   for(int i = 1; i&lt;n; i++) {  \r\n      if(arr[i] &gt; max_element)  \r\n         max_element = arr[i];  \r\n   }  \r\n   return max_element; \r\n}  \r\n  \r\nvoid countingSort(int arr[], int n, int pos) \r\n{  \r\n  int result[n + 1];  \r\n  int count[10] = {0};    \r\n  \r\n  \/\/ count howmany numbers are present with digit 0-9 at given position \r\n  for (int i = 0; i &lt; n; i++)  \r\n    count[(arr[i] \/ pos) % 10]++;  \r\n      \r\n  \/\/ now do prefix sum of the count array \r\n  for (int i = 1; i &lt; 10; i++)  \r\n    count[i] += count[i - 1];  \r\n  \r\n  \/\/ Place the elements in sorted order  \r\n  for (int i = n - 1; i &gt;= 0; i--) {  \r\n    result[count[(arr[i] \/ pos) % 10] - 1] = arr[i];  \r\n    count[(arr[i] \/ pos) % 10]--;  \r\n  }  \r\n  \r\n  for (int i = 0; i &lt; n; i++)  \r\n    arr[i] = result[i];  \r\n}  \r\n  \r\nvoid radixsort(int arr[], int n) {  \r\n  \r\n  int max_element = find_max(arr, n);  \r\n  \r\n  \/\/ counting sort from the least significant digit to the most significant digit  \r\n  for (int pos = 1; max_element \/ pos &gt; 0; pos *= 10)  \r\n    countingSort(arr, n, pos);  \r\n}  \r\n  \r\n\r\n  \r\nint main() {  \r\n  int arr[] = {312, 42, 635, 11, 8, 783, 954, 777};  \r\n  int n = sizeof(arr) \/ sizeof(arr[0]);  \r\n  \r\n  printf(\"An array before applying the radix sort: &#92;n\");  \r\n  for (int i = 0; i &lt; n; ++i) {  \r\n    printf(\"%d  \", arr[i]);  \r\n  }  \r\n  printf(\"&#92;n\");\r\n  \r\n  radixsort(arr, n);  \r\n  printf(\"An array after applying the radix sort: &#92;n\");  \r\n  for (int i = 0; i &lt; n; ++i) {  \r\n    printf(\"%d  \", arr[i]);  \r\n  }  \r\n  printf(\"&#92;n\");\r\n}<\/pre>\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t <\/div>\r\n\t\t\t\t\t \r\n\t\t\t\t <\/div>\r\n <script>\r\n\t\tjQuery(function () {\r\n\t\t\tjQuery('#myTab_11376 a:first').tab('show')\r\n\t\t});\r\n\t\t\r\n\t\t\t\tjQuery(function(){\r\n\t\t\tvar b=\"fadeIn\";\r\n\t\t\tvar c;\r\n\t\t\tvar a;\r\n\t\t\td(jQuery(\"#myTab_11376 a\"),jQuery(\"#tab-content_11376\"));function d(e,f,g){\r\n\t\t\t\te.click(function(i){\r\n\t\t\t\t\ti.preventDefault();\r\n\t\t\t\t\tjQuery(this).tab(\"show\");\r\n\t\t\t\t\tvar h=jQuery(this).data(\"easein\");\r\n\t\t\t\t\tif(c){c.removeClass(a);}\r\n\t\t\t\t\tif(h){f.find(\"div.active\").addClass(\"animated \"+h);a=h;}\r\n\t\t\t\t\telse{if(g){f.find(\"div.active\").addClass(\"animated \"+g);a=g;}else{f.find(\"div.active\").addClass(\"animated \"+b);a=b;}}c=f.find(\"div.active\");\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\r\n\t\tfunction do_resize(){\r\n\r\n\t\t\tvar width=jQuery( '.tab-content .tab-pane iframe' ).width();\r\n\t\t\tvar height=jQuery( '.tab-content .tab-pane iframe' ).height();\r\n\r\n\t\t\tvar toggleSize = true;\r\n\t\t\tjQuery('iframe').animate({\r\n\t\t\t    width: toggleSize ? width : 640,\r\n\t\t\t    height: toggleSize ? height : 360\r\n\t\t\t  }, 250);\r\n\r\n\t\t\t  toggleSize = !toggleSize;\r\n\t\t}\r\n\r\n\r\n\t<\/script>\r\n\t\t\t\t\r\n\t\t\t\n<p><strong>Output<\/strong><\/p>\n<pre><code>An array before applying the radix sort: \n312  42  635  11  8  783  954  777  \nAn array after applying the radix sort: \n8  11  42  312  635  777  783  954  <\/code><\/pre>\n<p>In the above radix sort program in c, We have created the function radixSort in which first, we will find the maximum of the array using the find_max function. After that, we will run a loop from 0 to the total number of a digit in max_element. During each loop, we will sort the array based on the given position using counting sort. In the counting sort function, we will create an array result to store the result after performing the sorting to a particular position. After that, we will count how many elements are present in the array from 0-9 at a given position and store it in the desired position. After that, we will place all the elements in the result array based on sorting. In the end, we will assign all the elements from the result array to the original array arr. Now, let\u2019s see what is the time complexity of the radix sort program in c and the space complexity of <a href=\"https:\/\/prepbytes.com\/blog\/c-programming\/basic-c-programs-examples\/\"><br \/>\nC program<\/a> of the radix sort.<\/p>\n<p>*<em>Time Complexity:  O(n<\/em>d)*<em> where n is the size of an array and d is the number of digits in the largest element of the array. In the worst case, we might end up sorting the array in each loop. Thus the time complexity of the radix sort program in c is O(n<\/em>d).<\/p>\n<p><strong>Space Complexity: O(n+d)<\/strong> because we are using extra arrays to store results and count.<\/p>\n<p><strong>Note:<\/strong> Radix sort is <strong>stable<\/strong> because after performing the sorting still the order of the element is maintained. Radix sort is <strong>not in-place<\/strong> because we are using extra space to sort the array.<\/p>\n<p><strong>Conclusion<\/strong><br \/>\nIn conclusion, Radix Sort is a non-comparative sorting algorithm that efficiently sorts integers by examining the digits or characters at different positions. It has a linear time complexity, making it an excellent choice for sorting large datasets with a fixed number of digits. By using a stable sorting algorithm as a subroutine, Radix Sort can achieve overall stability. The algorithm works by repeatedly sorting the elements based on their individual digits or characters, from the least significant position to the most significant position. Radix Sort is widely used in computer science and is particularly useful when dealing with large integers or strings.<\/p>\n<h2>Frequently Asked Questions (FAQs):<\/h2>\n<p><strong>Q1: What is Radix Sort?<\/strong><br \/>\nRadix Sort is a non-comparative sorting algorithm that sorts integers or strings based on their individual digits or characters at different positions. It achieves sorting by repeatedly sorting the elements according to their digits or characters from the least significant position to the most significant position.<\/p>\n<p><strong>Q2: How does Radix Sort work?<\/strong><br \/>\nRadix Sort works by distributing the elements into different buckets or queues based on the values of their digits or characters at a particular position. After sorting the elements based on a specific digit or character, it gathers them back into a single sequence. This process is repeated for each digit or character position, resulting in a fully sorted sequence.<\/p>\n<p><strong>Q3: What is the time complexity of Radix Sort?<\/strong><br \/>\nThe time complexity of Radix Sort is O(kN), where N is the number of elements to be sorted, and k is the number of digits or characters in the largest element. Since k is considered a constant factor, Radix Sort is often regarded as having linear time complexity, making it efficient for sorting large datasets.<\/p>\n<p><strong>Q4: Is Radix Sort a stable sorting algorithm?<\/strong><br \/>\nYes, Radix Sort can be made stable by using a stable sorting algorithm as a subroutine when sorting the elements based on each digit or character. By maintaining the relative order of elements with the same digit or character value, Radix Sort achieves overall stability.<\/p>\n<p><strong>Q5: In which scenarios is Radix Sort useful?<\/strong><br \/>\nRadix Sort is particularly useful when sorting large integers or strings with a fixed number of digits or characters. It is often employed in scenarios where a high-speed sorting algorithm is required and the range of possible values is known or limited. Examples include sorting student IDs, IP addresses, or fixed-length numeric representations.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will learn what is radix sort program in C, its algorithm, how it operates with a dry-run example, and how to implement a radix sort program in C with an example. What is radix sort? Radix sort is a linear sorting method that is exclusively used to sort arrays of the [&hellip;]<\/p>\n","protected":false},"author":52,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-11500","post","type-post","status-publish","format-standard","hentry","category-c-programming"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Radix Sort Program in C<\/title>\n<meta name=\"description\" content=\"Learn about what is radix sort program and algorithm with the working of radix sort in C.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Radix Sort Program in C\" \/>\n<meta property=\"og:description\" content=\"Learn about what is radix sort program and algorithm with the working of radix sort in C.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/\" \/>\n<meta property=\"og:site_name\" content=\"PrepBytes Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prepbytes0211\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-29T05:14:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-08T12:54:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006682-radix%20sort%20program%20in%20c.jpg\" \/>\n<meta name=\"author\" content=\"Prepbytes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prepbytes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/\"},\"author\":{\"name\":\"Prepbytes\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\"},\"headline\":\"Radix Sort Program in C\",\"datePublished\":\"2022-12-29T05:14:36+00:00\",\"dateModified\":\"2023-06-08T12:54:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/\"},\"wordCount\":1355,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006682-radix%20sort%20program%20in%20c.jpg\",\"articleSection\":[\"C Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/\",\"url\":\"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/\",\"name\":\"Radix Sort Program in C\",\"isPartOf\":{\"@id\":\"http:\/\/43.205.93.38\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006682-radix%20sort%20program%20in%20c.jpg\",\"datePublished\":\"2022-12-29T05:14:36+00:00\",\"dateModified\":\"2023-06-08T12:54:19+00:00\",\"description\":\"Learn about what is radix sort program and algorithm with the working of radix sort in C.\",\"breadcrumb\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/#primaryimage\",\"url\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006682-radix%20sort%20program%20in%20c.jpg\",\"contentUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006682-radix%20sort%20program%20in%20c.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/43.205.93.38\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C Programming\",\"item\":\"https:\/\/prepbytes.com\/blog\/category\/c-programming\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Radix Sort Program in C\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/43.205.93.38\/#website\",\"url\":\"http:\/\/43.205.93.38\/\",\"name\":\"PrepBytes Blog\",\"description\":\"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING\",\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/43.205.93.38\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/43.205.93.38\/#organization\",\"name\":\"Prepbytes\",\"url\":\"http:\/\/43.205.93.38\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"contentUrl\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"width\":160,\"height\":160,\"caption\":\"Prepbytes\"},\"image\":{\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/prepbytes0211\/\",\"https:\/\/www.instagram.com\/prepbytes\/\",\"https:\/\/www.linkedin.com\/company\/prepbytes\/\",\"https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\",\"name\":\"Prepbytes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"caption\":\"Prepbytes\"},\"url\":\"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Radix Sort Program in C","description":"Learn about what is radix sort program and algorithm with the working of radix sort in C.","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:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/","og_locale":"en_US","og_type":"article","og_title":"Radix Sort Program in C","og_description":"Learn about what is radix sort program and algorithm with the working of radix sort in C.","og_url":"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/","og_site_name":"PrepBytes Blog","article_publisher":"https:\/\/www.facebook.com\/prepbytes0211\/","article_published_time":"2022-12-29T05:14:36+00:00","article_modified_time":"2023-06-08T12:54:19+00:00","og_image":[{"url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006682-radix%20sort%20program%20in%20c.jpg","type":"","width":"","height":""}],"author":"Prepbytes","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Prepbytes","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/#article","isPartOf":{"@id":"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/"},"author":{"name":"Prepbytes","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e"},"headline":"Radix Sort Program in C","datePublished":"2022-12-29T05:14:36+00:00","dateModified":"2023-06-08T12:54:19+00:00","mainEntityOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/"},"wordCount":1355,"commentCount":0,"publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006682-radix%20sort%20program%20in%20c.jpg","articleSection":["C Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/","url":"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/","name":"Radix Sort Program in C","isPartOf":{"@id":"http:\/\/43.205.93.38\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/#primaryimage"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006682-radix%20sort%20program%20in%20c.jpg","datePublished":"2022-12-29T05:14:36+00:00","dateModified":"2023-06-08T12:54:19+00:00","description":"Learn about what is radix sort program and algorithm with the working of radix sort in C.","breadcrumb":{"@id":"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/#primaryimage","url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006682-radix%20sort%20program%20in%20c.jpg","contentUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1672290006682-radix%20sort%20program%20in%20c.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/prepbytes.com\/blog\/radix-sort-program-in-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/43.205.93.38\/"},{"@type":"ListItem","position":2,"name":"C Programming","item":"https:\/\/prepbytes.com\/blog\/category\/c-programming\/"},{"@type":"ListItem","position":3,"name":"Radix Sort Program in C"}]},{"@type":"WebSite","@id":"http:\/\/43.205.93.38\/#website","url":"http:\/\/43.205.93.38\/","name":"PrepBytes Blog","description":"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING","publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/43.205.93.38\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/43.205.93.38\/#organization","name":"Prepbytes","url":"http:\/\/43.205.93.38\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/","url":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","contentUrl":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","width":160,"height":160,"caption":"Prepbytes"},"image":{"@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/prepbytes0211\/","https:\/\/www.instagram.com\/prepbytes\/","https:\/\/www.linkedin.com\/company\/prepbytes\/","https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA"]},{"@type":"Person","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e","name":"Prepbytes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","caption":"Prepbytes"},"url":"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/"}]}},"_links":{"self":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/11500","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/comments?post=11500"}],"version-history":[{"count":3,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/11500\/revisions"}],"predecessor-version":[{"id":16734,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/11500\/revisions\/16734"}],"wp:attachment":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/media?parent=11500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/categories?post=11500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/tags?post=11500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}