Radix Sort Using Couting Sort
Duration: 32 min
This video lesson is available to enrolled students.
Inside: a video lesson and guided study material.
Module outline
- About the Course: About the Course
- Paper-1 & 2 | Basic Numeracy: Ratio and Proportion (Ratios), Divisibility Rules, Mixture and Alligation, Permutation and Combination, Logarithm, Number System, HCF LCM, Sequence and Series (Series), Speed Time and Distance, Percentage, Average, Mensuration and Geometry, Age Problems, Arithmetic, Statistics, Probability, Profit and Loss, Simple Interest and Compound Interest, Partnership, Speed Mathematics and Basic Mathematics, Algebra, Powers and Exponents (Surds and Indices), Time and Work, Pipe and Cistern, RSSB Specific Videos - Basic Numeracy
- Paper-1 & 2 | Data Interpretation: Data Interpretation
- Paper-1 & 2 | General Mental Ability: Mental Ability, RSSB Specific Videos - Mental Ability
- Paper-1 & 2 | Logical Reasoning and Analytical Ability: Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Syllogisms, Seating Arrangements, Blood Relations, Directions (Direction Test), Analytical Reasoning (Counting Figures Reasoning), Puzzle Solving (Puzzles), Calendar, Clock, Cubes & Dices, Venn Diagram, Analogy, Ranking, Order and Sequence, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Data Arrangement, Logical Sequence Of Words, Crypt Arithmetic
- Paper-1 & 2 | Decision Making and Problem Solving: Selection Decision Table (Decision Making)
- Paper-1 | General Science: Physics, Biology, Chemistry, RSSB Specific Videos
- Paper-1 | General Awareness: State Wise GK, GK- Current Affairs
- Paper - 2 | Digital Logic Systems: Digital Systems & Boolean Basics, Logic Gates & Hardware, Combinational Circuit, Sequential Circuits
- Paper-2 | Database Management System: Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Decomposition Properties & 4NF, Relational Calculus, Relational Algebra, SQL, NoSQL
- Paper-2 | Data Structures & Algorithms: Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Algorithm Analysis, Sorting Algorithms, Intro to Compilers, Hashing
- Paper 2 | Data Communication and Network Security: Introduction to CN, Data Communication, Data Link Layer - Ethernet, DLL: Error Control, Net Layer: IPv4 & Proto, Net Layer: IP Addressing, Application Layer, Hardware basics, Network Security, Ethical Hacking
- Paper-2 | Operating Systems: Introduction to OS, Process Management, Memory Management, File Management, Deadlock
- Paper-2 | Computer Organization and Architecture: Basics of COA, Floating Point Rep, Cache Memory Organization, Input Output Organisation, Instr Formats & Modes, Control Unit Design, Register Transfer and Microoperations, Programming the Basic Computer, Number System, Number Representation
- Paper 2 | System Analysis and Design: Fundamentals of Systems and Information Systems, Fundamentals of Software Engineering, SDLC and Development Approaches, Software Documentation and Software Requirements Specification (SRS), SDD and Quality Assurance, Security, Risk Management & Maintenance, Software Testing
- Paper-2 | C Programming: C Fundamentals, Control Flow, Functions, Arrays & Pointers, Storage Classes, Structures & Enums, DMA, Macros, Scoping & File Handling
- Paper 2 | OOPS , C++ , JAVA: Language Design, OOPS with C++, Java, .Net Programming, Java Fundamentals
- Paper 2 | Python: Introduction to Python, Tokens, Variables, Data Types, I/O, Operators & Expressions, Control Flow & Looping, Collections & Strings, Functions & Modules, File Handling & Data Analysis
- Emerging Trends and AI: Emerging Tech Trends, Artificial Intelligence
- Paper-2 | Data Processing (Ms-Office): MS Office Applications
- Paper-2 | Internet and Web Technologies: HTML Basics, CSS, XML, JavaScript-Basics, Internet Fundamentals, Protocols & Services, Web Publishing & Hosting, Server Side & Security, Emerging Technologies, Terms & Abbreviations, Cyber Threats and Malware Attacks, Role of Internet and Web Services, Security in Mobile and Wireless Computing
- Paper 2 | Pedagogy: Child Development, Theories, Concept of Pedagogy, Inclusive Education, Experiential Pedagogy, Assessment & Evaluation, Psychology, Curriculum Framework & Reforms, National Education Policy (NEP) 2020
- Live Classes: RSSB Live Sessions
- Paper 1 - Full Mock Tests:
- Paper 2 - Full Mock Tests:
- BCI Previous Year Papers:
AI summary & chapters
AI Summary
An AI-generated summary of this video lecture.
This lecture provides a comprehensive walkthrough of Radix Sort implemented using Counting Sort as the underlying subroutine. The instructor begins by defining Radix Sort as a non-comparison based sorting algorithm that processes elements digit by digit, specifically from the Least Significant Digit (LSD) to the Most Significant Digit (MSD). The core concept relies on the stability of Counting Sort, ensuring that elements with equal keys maintain their relative order during intermediate passes. The demonstration utilizes a sample array of eight integers, such as 178, 002, 169, and 314, to illustrate the mechanics of sorting. The radix is established as 10 for decimal numbers, meaning digits range from 0 to 9. The instructor visually constructs an auxiliary counting array 'C' initialized with zeros, which is then populated by iterating through the input array to count the frequency of each digit at the current position being processed. The lecture progresses through multiple passes, first sorting by the ones place (LSD), then the tens place, and finally the hundreds place. In each pass, the counting array is modified to store cumulative counts, which determines the correct position of elements in a temporary output array 'b'. The video concludes by deriving the time complexity as O(dn), where d is the number of digits and n is the array size, and space complexity as O(n+k), simplifying to O(n) when radix is treated as a constant.
Chapters
0:00 – 2:00 00:00-02:00
The lecture opens with an introduction to Radix Sort using Counting Sort, explicitly labeled on screen as a 'Non Comparison Based Sorting Algorithm'. The instructor defines the sorting strategy as processing digits from the Least Significant Digit (LSD) to the Most Significant Digit (MSD). A sample array 'a' is displayed containing eight integers: 178, 002, 169, 314, 521, 738, 142, and 194. The digit range is identified as 0-9 with a radix of 10, setting the stage for the decimal sorting demonstration. The instructor emphasizes that Counting Sort serves as a stable subroutine at each digit position.
2:00 – 5:00 02:00-05:00
The instructor begins the practical demonstration by initializing an auxiliary counting array 'C' with zeros. The focus shifts to processing the Least Significant Digit (LSD), which corresponds to the ones place of each number in array 'a'. The instructor underlines specific digits, such as the 8 in 178 and the 2 in 002, to indicate which position is currently being sorted. The counting array 'C' starts empty and begins to be populated with frequencies corresponding to the last digits of the numbers. The visual setup clearly distinguishes between the input array 'a' and the auxiliary counting structure required for the algorithm.
5:00 – 10:00 05:00-10:00
The process of populating the counting array 'C' continues as the instructor iterates through every element in the input array. For each number, the last digit is extracted and used as an index to increment the value in array 'C'. For example, if a number ends in 2, the count at index 2 of 'C' is incremented. The on-screen text confirms that digits range from 0-9 and the radix remains 10. The instructor demonstrates how to map input numbers to their respective digit counts, building the frequency distribution necessary for the next step of determining positions. The array 'C' transitions from all zeros to a populated state reflecting the distribution of ones digits.
10:00 – 15:00 10:00-15:00
The instructor modifies the counting array 'C' to store cumulative counts, a critical step for stable sorting. This transformation allows the algorithm to determine the final position of each element in the output array 'b'. The video shows arrows indicating the mapping from input numbers to their sorted positions based on the cumulative counts. Elements like 142 and 194 are placed into the output array 'b' based on their ones digit. The text on screen highlights that Counting Sort is used as a stable sorting algorithm at each digit position, ensuring the relative order of elements with identical digits is preserved during this pass.
15:00 – 20:00 15:00-20:00
The first pass of sorting is completed, and the instructor prepares for the next iteration by processing the tens place. The data from the temporary output array 'b' is copied back into the source array 'a', effectively updating the input for the next digit position. The counting sort array 'c' is re-initialized to zeros, and the process repeats for the second least significant digit. The instructor demonstrates how the array evolves after sorting by the ones place, showing intermediate states where numbers are partially ordered. This step-by-step progression highlights the iterative nature of Radix Sort, moving systematically from LSD to MSD.
20:00 – 25:00 20:00-25:00
The sorting process continues with the tens place digit. The instructor applies Counting Sort logic again, this time extracting the middle digit of each number (e.g., 7 from 178, 0 from 002). The counting array 'c' is populated with frequencies of these tens digits, and cumulative sums are calculated to determine positions in the output array. The visual evidence shows intermediate arrays labeled 'a', 'c', and a sorted version, illustrating the stability of the sort. The instructor tracks index positions 0-9 for digit buckets, ensuring that elements are placed correctly relative to their tens digit values.
25:00 – 30:00 25:00-30:00
The final pass of the sorting algorithm is executed, focusing on the Most Significant Digit (MSD), which corresponds to the hundreds place. The instructor demonstrates how the array is sorted based on these leading digits, completing the Radix Sort process. The final output array 'b' is shown with numbers in fully ascending order, confirming the correctness of the algorithm. The visual progression from unsorted to sorted is clear, with intermediate arrays showing the state after each digit pass. The instructor emphasizes that this method works for any number of digits, provided the counting sort subroutine is applied correctly at each stage.
30:00 – 31:56 30:00-31:56
The lecture concludes with an analysis of the time and space complexity. The instructor writes the formula O(dn) for time complexity, defining 'd' as the number of digits in each element and 'n' as the total number of elements. Space complexity is derived as O(n+k), where k represents the radix (10 in this case). The instructor notes that since the radix is a constant, the space complexity simplifies to O(n). The final frames show the sorted array 'a' with indices 1-8, alongside the counting array 'c', reinforcing the relationship between the algorithm's structure and its efficiency metrics.
The lecture effectively bridges theoretical concepts with practical implementation by using a concrete example of sorting eight integers. The key takeaway is the iterative application of Counting Sort, which acts as a stable subroutine to sort digits from LSD to MSD. The stability of Counting Sort is crucial; without it, the relative order established in previous passes would be lost. The visual aids, including underlined digits and evolving arrays 'a', 'b', and 'c', provide clear evidence of the algorithm's mechanics. The complexity analysis at the end solidifies understanding by quantifying performance in terms of digits and array size. This approach demonstrates why Radix Sort is efficient for large datasets with fixed-length keys, avoiding the O(n log n) lower bound of comparison-based sorts.