Summary
Keywords
Full Transcript
Support Simple Snippets by Donations - Google Pay UPI ID - tanmaysakpal11@okicici PayPal - paypal.me/tanmaysakpal11 --------------------------------------------------------------------------------------------- In this DSA tutorial we will study and understand the working of Radix Sort sorting algorithm. Radix sort also known as bucket sort, is a non comparative sorting algorithm. It avoids comparison by creating and distributing elements into buckets according to their radix. For elements with more than one significant digit, this bucketing process is repeated for each digit, while preserving the ordering of the prior step, until all digits have been considered. For this reason, radix sort has also been called bucket sort and digital sort. Typically Radix sort uses counting sort as a subroutine to sort. Radix sort has linear time complexity which is better than O(nlog n) of comparative sorting algorithms. Worst complexity: n*k/d Average complexity: n*k/d Space complexity: n+2^d Working - Step 1 - Take input array and find MAX number in the array Step 2 - Define 10 queues each representing a bucket for each digit from 0 to 9. Step 3 - Consider the least significant digit of each number in the list which is to be sorted. Step 4 - Insert each number into their respective queue based on the least significant digit. Step 5 - Group all the numbers from queue 0 to queue 9 in the order they have inserted into their respective queues. Step 6 - Repeat from step 3 based on the next least significant digit. Step 7 - Repeat from step 2 until all the numbers are grouped based on the most significant digit. Full DSA playlist - https://www.youtube.com/watch?v=XCyuHSJS7XE&list=PLIY8eNdw5tW_zX3OCzX7NJ8bL1p6pWfgG Full Code & Theory article - https://simplesnippets.tech/radix-sort-algorithm-with-c-code-sorting-algorithms-data-structures-algorithms/ C++ Programming Tutorials for Beginners Course - https://www.youtube.com/watch?v=AKNGgAXTark&list=PLIY8eNdw5tW_o8gsLqNBu8gmScCAqKm2Q Simple Snippets Official Website - http://simplesnippets.tech/ Simple Snippets on Facebook - https://www.facebook.com/simplesnippets/ Simple Snippets on Instagram - https://www.instagram.com/simplesnippets/ Simple Snippets on Twitter - https://twitter.com/simplesnippet Simple Snippets Google Plus Page - https://plus.google.com/+SimpleSnippets Simple Snippets email ID - [email protected] For More Technology News, Latest Updates and Blog articles visit our Official Website - http://simplesnippets.tech/
