SlideShare a Scribd company logo
SORTING
TYPES: 
• Quick Sort 
• Insertion Sort 
• Shell Sort 
• Merge Sort
INSERTION SORT
INSERTION SORT: 
• One of the simplest algorithm. 
• Requires (n-1) steps…’n’-no. of 
elements. 
• Data movement takes place 
with the help of ’tmp’ and not 
by swapping.
Sorting1
Sorting1
SHELL SORT
SHELL SORT: 
• Named after Donald shell. 
• It compares the elements that are at 
distance. 
Shell sort is sometimes referred to as 
”diminishing increment” sort. 
• The sorting number that is chosen 
must always be an odd number.
Original 81 94 11 96 12 35 17 95 28 58 41 75 15 
After 
5-sort 
35 17 11 28 12 41 75 15 96 58 81 94 95 
After 
3-sort 28 12 11 35 15 41 58 17 94 75 81 96 95 
After 
1-sort 11 12 15 17 28 35 41 58 75 81 94 95 96
MERGE SORT
MERGE SORT: 
• It is a fine example of a recursive 
algorithm. 
• Makes use of 2 input array that are 
sorted among them. 
• Almost (n-1) comparisons. 
• Divide and conquer strategy.
1 13 24 26 2 15 27 38 
1 
1 13 24 26 2 15 27 38 
1 2 
1 13 24 26 2 15 27 38 
1 2 13
1 13 24 26 2 15 27 38 
1 2 13 15 
1 13 24 26 2 15 27 38 
1 2 13 15 24 
1 13 24 26 2 15 27 38 
1 2 13 15 24 26
1 13 24 26 2 15 27 38 
1 2 13 15 24 26 27 
1 13 24 26 2 15 27 38 
1 2 13 15 24 26 27 38
QUICK SORT
8 1 5 14 4 15 12 6 2 11 7 10 
6 1 5 7 4 2 8 14 15 11 1 0 12 
1 4 2 5 6 7 8 11 10 12 14 15 
1 2 4 5 6 7 8 11 10 12 14 15 
1 2 4 5 6 7 8 10 11 12 14 15 
8
Sorting1

More Related Content

PDF
LEC 8-DS ALGO(heaps).pdf
PPTX
Offset in and offset out constraints
PPT
Randomizing quicksort algorith with example
PPTX
Rs flipflop or SR flipFlop
PPTX
D flip flop in Digital electronics
PPTX
JK flip flop in Digital electronics
PPT
Sorting Techniques
PPTX
Radix sort presentation
LEC 8-DS ALGO(heaps).pdf
Offset in and offset out constraints
Randomizing quicksort algorith with example
Rs flipflop or SR flipFlop
D flip flop in Digital electronics
JK flip flop in Digital electronics
Sorting Techniques
Radix sort presentation

Similar to Sorting1 (20)

PDF
merge sort
PDF
Python week4-lecture1-handout
PPTX
Sortings .pptx
PPTX
L2_DatabAlgorithm Basics with Design & Analysis.pptx
PPTX
2.Problem Solving Techniques and Data Structures.pptx
PDF
01 - 01 January - Sorting
PPT
MergesortQuickSort.ppt
PPT
presentation_mergesortquicksort_1458716068_193111.ppt
PDF
01 analysis-of-algorithms
PPTX
Data Structure and algorithms for software
PPTX
Merge sort analysis and its real time applications
PPT
Lec 6 Divide and conquer of Data Structures & Algortihms
PPT
PDF
Skiena algorithm 2007 lecture08 quicksort
PDF
Sienna 4 divideandconquer
PPTX
Advanced Sorting Algorithms
PPT
Insert Sort & Merge Sort Using C Programming
PPTX
Introduction to Algorithms
merge sort
Python week4-lecture1-handout
Sortings .pptx
L2_DatabAlgorithm Basics with Design & Analysis.pptx
2.Problem Solving Techniques and Data Structures.pptx
01 - 01 January - Sorting
MergesortQuickSort.ppt
presentation_mergesortquicksort_1458716068_193111.ppt
01 analysis-of-algorithms
Data Structure and algorithms for software
Merge sort analysis and its real time applications
Lec 6 Divide and conquer of Data Structures & Algortihms
Skiena algorithm 2007 lecture08 quicksort
Sienna 4 divideandconquer
Advanced Sorting Algorithms
Insert Sort & Merge Sort Using C Programming
Introduction to Algorithms
Ad

Recently uploaded (20)

PPTX
Construction Project Organization Group 2.pptx
PPT
Project quality management in manufacturing
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
composite construction of structures.pdf
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
PPT on Performance Review to get promotions
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
737-MAX_SRG.pdf student reference guides
PDF
III.4.1.2_The_Space_Environment.p pdffdf
DOCX
573137875-Attendance-Management-System-original
PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
OOP with Java - Java Introduction (Basics)
Construction Project Organization Group 2.pptx
Project quality management in manufacturing
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Embodied AI: Ushering in the Next Era of Intelligent Systems
composite construction of structures.pdf
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
UNIT-1 - COAL BASED THERMAL POWER PLANTS
bas. eng. economics group 4 presentation 1.pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Internet of Things (IOT) - A guide to understanding
PPT on Performance Review to get promotions
Foundation to blockchain - A guide to Blockchain Tech
737-MAX_SRG.pdf student reference guides
III.4.1.2_The_Space_Environment.p pdffdf
573137875-Attendance-Management-System-original
Safety Seminar civil to be ensured for safe working.
Fundamentals of safety and accident prevention -final (1).pptx
Operating System & Kernel Study Guide-1 - converted.pdf
OOP with Java - Java Introduction (Basics)
Ad

Sorting1

  • 2. TYPES: • Quick Sort • Insertion Sort • Shell Sort • Merge Sort
  • 4. INSERTION SORT: • One of the simplest algorithm. • Requires (n-1) steps…’n’-no. of elements. • Data movement takes place with the help of ’tmp’ and not by swapping.
  • 8. SHELL SORT: • Named after Donald shell. • It compares the elements that are at distance. Shell sort is sometimes referred to as ”diminishing increment” sort. • The sorting number that is chosen must always be an odd number.
  • 9. Original 81 94 11 96 12 35 17 95 28 58 41 75 15 After 5-sort 35 17 11 28 12 41 75 15 96 58 81 94 95 After 3-sort 28 12 11 35 15 41 58 17 94 75 81 96 95 After 1-sort 11 12 15 17 28 35 41 58 75 81 94 95 96
  • 11. MERGE SORT: • It is a fine example of a recursive algorithm. • Makes use of 2 input array that are sorted among them. • Almost (n-1) comparisons. • Divide and conquer strategy.
  • 12. 1 13 24 26 2 15 27 38 1 1 13 24 26 2 15 27 38 1 2 1 13 24 26 2 15 27 38 1 2 13
  • 13. 1 13 24 26 2 15 27 38 1 2 13 15 1 13 24 26 2 15 27 38 1 2 13 15 24 1 13 24 26 2 15 27 38 1 2 13 15 24 26
  • 14. 1 13 24 26 2 15 27 38 1 2 13 15 24 26 27 1 13 24 26 2 15 27 38 1 2 13 15 24 26 27 38
  • 16. 8 1 5 14 4 15 12 6 2 11 7 10 6 1 5 7 4 2 8 14 15 11 1 0 12 1 4 2 5 6 7 8 11 10 12 14 15 1 2 4 5 6 7 8 11 10 12 14 15 1 2 4 5 6 7 8 10 11 12 14 15 8