SlideShare a Scribd company logo
8
Most read
9
Most read
12
Most read
RADIX AND MERGE SORT
C365 – IT ELECTIVE 4 (ANALYSIS OF ALGORITHM)
RADIX SORT
C365 - IT ELECTIVE 4 (ANALYSIS OF ALGORITHM)
WHAT IS RADIX SORT?
• Radix sort is a non-comparative sorting algorithm that sorts data with integer keys by grouping keys by
the individual digits which share the same significant position and value.
• It is one of the most efficient and fastest linear sorting algorithms.
COMPLEXITY
• The complexity of radix sort is linear, which in terms of omega means O(n). That is a great benefit in
performance compared to O(n.log(n)) or even worse with O(n2).
ADVANTAGES OF RADIX SORT
• Fast
• Radix sort is very fast compared to other sorting algorithms. This algorithm is very useful in practice because in
practice we often sort sets of integers.
• Easy to understand and implement
• Even a beginner can understand and implement radix sort, which is great. You need no more than few loops to
implement it.
DISADVANTAGES OF RADIX SORT
• Works only with integers
• If you’re not sure about the input better do not use radix sort. We may think that our input consists only of
integers and we can go for radix sort, but what if in the future someone passes floats or strings to our routine.
• Requires additional space
• Radix sort needs additional space – at least as much as the input.
PSEUDOCODE
EXAMPLE
• For 1st pass: we sort the array on basis of least
significant digit (1s place) using counting sort.
Notice that 435 is below 835, because
435 occurred below 835 in the original list.
EXAMPLE
• For 2nd pass: we sort the array on basis of next
digit (10s place) using counting sort. Notice that
here 608 is below 704, because 608 occurred
below 704 in the previous list, and similarly for
(835, 435) and (751, 453).
EXAMPLE
• For 3rd pass: we sort the array on basis of most
significant digit (100s place) using counting sort.
Notice that here 435 is below 453, because 435
occurred below 453 in the previous list, and
similarly for (608, 690) and (704, 751).
MERGE SORT
C365 - IT ELECTIVE 4 (ANALYSIS OF ALGORITHM)
WHAT IS MERGE SORT?
• Merging is the process of taking two smaller sorted lists and combining them together into a single,
sorted, new list.
• Merge sort is a recursive algorithm that continually splits a list in half. If the list is empty or has one
item, it is sorted by definition (the base case). If the list has more than one item, we split the list and
recursively invoke a merge sort on both halves. Once the two halves are sorted, the fundamental
operation, called a merge, is performed.
COMPLEXITY
• Merge Sort is a recursive algorithm and time complexity can be expressed as following recurrence
relation.
• 𝑇 𝑛 = 2𝑇 (𝑛/2) + θ(𝑛)
• Time complexity of Merge Sort is 𝜃(𝑛𝐿𝑜𝑔𝑛) in all 3 cases (worst, average and best) as merge sort
always divides the array in two halves and take linear time to merge two halves.
ADVANTAGES OF MERGE SORT
• Merge sort is a great sorting algorithm mainly because it’s very fast and stable. It’s complexity is the
same even in the worst case and it is O(n*log(n)).
• Merge sort is easy to implement. Indeed most of the developer consider something fast to be difficult
to implement.
DISADVANTAGES OF MERGE SORT
• In many implementations, if the list is N long, then it needs 2 x N memory space to handle the sort.
• If recursion is used to code the algorithm then it uses twice as much stack memory as quicksort - on the
other hand it is not difficult to code using iteration rather than recursion and so avoid the memory
penalty.
• Need for the temporary array to store the merged elements, which requires O(N) space.
PSEUDOCODE
EXAMPLE
• If we take a closer look at the diagram, we can
see that the array is recursively divided in two
halves till the size becomes 1. Once the size
becomes 1, the merge processes comes into
action and starts merging arrays back till the
complete array is merged.

More Related Content

PPTX
introduction to NOSQL Database
PPT
Queue data structure
PPTX
Searching techniques in Data Structure And Algorithm
PPTX
Round Robin Algorithm.pptx
PPTX
Sorting in python
PPTX
Presentation on queue
PDF
Algorithms Lecture 4: Sorting Algorithms I
PPTX
introduction to NOSQL Database
Queue data structure
Searching techniques in Data Structure And Algorithm
Round Robin Algorithm.pptx
Sorting in python
Presentation on queue
Algorithms Lecture 4: Sorting Algorithms I

What's hot (20)

PPTX
Merge Sort
PPTX
Selection sorting
PPT
concurrency-control
PPT
Algorithm analysis
PPTX
Bubble Sort Algorithm Presentation
PPTX
Merge sort algorithm power point presentation
PDF
Parquet Strata/Hadoop World, New York 2013
PDF
Algorithms Lecture 5: Sorting Algorithms II
PDF
Physical Plans in Spark SQL
PPTX
Disk Scheduling Algorithm in Operating System
PDF
PDF
Advanced Streaming Analytics with Apache Flink and Apache Kafka, Stephan Ewen
PPTX
Hashing Technique In Data Structures
PPTX
Binary Search Tree in Data Structure
PPTX
Ppt bubble sort
PDF
Stream Processing – Concepts and Frameworks
PDF
Web scraping in python
PPTX
Quick sort
PPTX
Operating system 37 demand paging
PPT
Fundamentals of the Analysis of Algorithm Efficiency
Merge Sort
Selection sorting
concurrency-control
Algorithm analysis
Bubble Sort Algorithm Presentation
Merge sort algorithm power point presentation
Parquet Strata/Hadoop World, New York 2013
Algorithms Lecture 5: Sorting Algorithms II
Physical Plans in Spark SQL
Disk Scheduling Algorithm in Operating System
Advanced Streaming Analytics with Apache Flink and Apache Kafka, Stephan Ewen
Hashing Technique In Data Structures
Binary Search Tree in Data Structure
Ppt bubble sort
Stream Processing – Concepts and Frameworks
Web scraping in python
Quick sort
Operating system 37 demand paging
Fundamentals of the Analysis of Algorithm Efficiency
Ad

Similar to Radix and Merge Sort (20)

PPTX
Mergesort
PPTX
Lecture -16-merge sort (slides).pptx
PPTX
DSA- Merge Sort-a sorting technique.pptx
PPTX
dsa presentation on merge sorting in C++.pptx
PPTX
Sorting ppt
PPTX
Data structure Merge Sort implementation
PPTX
Presentation merge sort.pptx
PPTX
MergeSort presentation dgdfgdfgdfgg.pptx
PPTX
Different Searching and Sorting Methods.pptx
PPTX
Merge sort analysis and its real time applications
PPTX
Insertion and merge sort
PPTX
Merge Sort (w/ principle, algorithm, code, visualizations)
PPTX
Merge sort
PPTX
Merge sort
PDF
advanced algo
PPT
03_sorting123456789454545454545444543.ppt
PPT
03_sorting and it's types with example .ppt
PPT
quicksortnmsd cmz ,z m,zmm,mbfjjjjhjhfjsg
DOCX
Merge sort lab mannual
PPTX
merg sort slide created by anas sanan.pptx
Mergesort
Lecture -16-merge sort (slides).pptx
DSA- Merge Sort-a sorting technique.pptx
dsa presentation on merge sorting in C++.pptx
Sorting ppt
Data structure Merge Sort implementation
Presentation merge sort.pptx
MergeSort presentation dgdfgdfgdfgg.pptx
Different Searching and Sorting Methods.pptx
Merge sort analysis and its real time applications
Insertion and merge sort
Merge Sort (w/ principle, algorithm, code, visualizations)
Merge sort
Merge sort
advanced algo
03_sorting123456789454545454545444543.ppt
03_sorting and it's types with example .ppt
quicksortnmsd cmz ,z m,zmm,mbfjjjjhjhfjsg
Merge sort lab mannual
merg sort slide created by anas sanan.pptx
Ad

Recently uploaded (20)

PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
medical staffing services at VALiNTRY
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Nekopoi APK 2025 free lastest update
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
history of c programming in notes for students .pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
System and Network Administration Chapter 2
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Transform Your Business with a Software ERP System
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
top salesforce developer skills in 2025.pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Softaken Excel to vCard Converter Software.pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
medical staffing services at VALiNTRY
Odoo Companies in India – Driving Business Transformation.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 41
L1 - Introduction to python Backend.pptx
Odoo POS Development Services by CandidRoot Solutions
Design an Analysis of Algorithms I-SECS-1021-03
Nekopoi APK 2025 free lastest update
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
2025 Textile ERP Trends: SAP, Odoo & Oracle
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
history of c programming in notes for students .pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
System and Network Administration Chapter 2
How Creative Agencies Leverage Project Management Software.pdf
Transform Your Business with a Software ERP System
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
top salesforce developer skills in 2025.pdf

Radix and Merge Sort

  • 1. RADIX AND MERGE SORT C365 – IT ELECTIVE 4 (ANALYSIS OF ALGORITHM)
  • 2. RADIX SORT C365 - IT ELECTIVE 4 (ANALYSIS OF ALGORITHM)
  • 3. WHAT IS RADIX SORT? • Radix sort is a non-comparative sorting algorithm that sorts data with integer keys by grouping keys by the individual digits which share the same significant position and value. • It is one of the most efficient and fastest linear sorting algorithms.
  • 4. COMPLEXITY • The complexity of radix sort is linear, which in terms of omega means O(n). That is a great benefit in performance compared to O(n.log(n)) or even worse with O(n2).
  • 5. ADVANTAGES OF RADIX SORT • Fast • Radix sort is very fast compared to other sorting algorithms. This algorithm is very useful in practice because in practice we often sort sets of integers. • Easy to understand and implement • Even a beginner can understand and implement radix sort, which is great. You need no more than few loops to implement it.
  • 6. DISADVANTAGES OF RADIX SORT • Works only with integers • If you’re not sure about the input better do not use radix sort. We may think that our input consists only of integers and we can go for radix sort, but what if in the future someone passes floats or strings to our routine. • Requires additional space • Radix sort needs additional space – at least as much as the input.
  • 8. EXAMPLE • For 1st pass: we sort the array on basis of least significant digit (1s place) using counting sort. Notice that 435 is below 835, because 435 occurred below 835 in the original list.
  • 9. EXAMPLE • For 2nd pass: we sort the array on basis of next digit (10s place) using counting sort. Notice that here 608 is below 704, because 608 occurred below 704 in the previous list, and similarly for (835, 435) and (751, 453).
  • 10. EXAMPLE • For 3rd pass: we sort the array on basis of most significant digit (100s place) using counting sort. Notice that here 435 is below 453, because 435 occurred below 453 in the previous list, and similarly for (608, 690) and (704, 751).
  • 11. MERGE SORT C365 - IT ELECTIVE 4 (ANALYSIS OF ALGORITHM)
  • 12. WHAT IS MERGE SORT? • Merging is the process of taking two smaller sorted lists and combining them together into a single, sorted, new list. • Merge sort is a recursive algorithm that continually splits a list in half. If the list is empty or has one item, it is sorted by definition (the base case). If the list has more than one item, we split the list and recursively invoke a merge sort on both halves. Once the two halves are sorted, the fundamental operation, called a merge, is performed.
  • 13. COMPLEXITY • Merge Sort is a recursive algorithm and time complexity can be expressed as following recurrence relation. • 𝑇 𝑛 = 2𝑇 (𝑛/2) + θ(𝑛) • Time complexity of Merge Sort is 𝜃(𝑛𝐿𝑜𝑔𝑛) in all 3 cases (worst, average and best) as merge sort always divides the array in two halves and take linear time to merge two halves.
  • 14. ADVANTAGES OF MERGE SORT • Merge sort is a great sorting algorithm mainly because it’s very fast and stable. It’s complexity is the same even in the worst case and it is O(n*log(n)). • Merge sort is easy to implement. Indeed most of the developer consider something fast to be difficult to implement.
  • 15. DISADVANTAGES OF MERGE SORT • In many implementations, if the list is N long, then it needs 2 x N memory space to handle the sort. • If recursion is used to code the algorithm then it uses twice as much stack memory as quicksort - on the other hand it is not difficult to code using iteration rather than recursion and so avoid the memory penalty. • Need for the temporary array to store the merged elements, which requires O(N) space.
  • 17. EXAMPLE • If we take a closer look at the diagram, we can see that the array is recursively divided in two halves till the size becomes 1. Once the size becomes 1, the merge processes comes into action and starts merging arrays back till the complete array is merged.