SlideShare a Scribd company logo
1
 Introduction
 Sorting
 Selection Sort
 Bubble Sort
 Bubble Sorting:- Example
 Sorting and searching are fundamental
operations in computer science.
 Sorting refers to operation of arranging data
in some given order , such as increasing or
decreasing ,with numerical data or with
character data.
 Generally, collections of data are presented
in a sorted manner.
 Let A be a list of n elements A1,A2,……An in
Memory. Sorting A refers to the operation of
rearranging the contents of A so that they
are in increasing in order, so that
A1<A2<A3<…..<An
 Sorting = ordering.
 Sorted = ordered based on a particular way.
 Examples of Sorting:
 Words in a dictionary are sorted (and case
distinctions are ignored).
 Files in a directory are often listed in sorted
order.
 The index of a book is sorted (and case
distinctions are ignored).
 A relatively easy to understand algorithm
 Sorts an array in passes
 Each pass selects the next smallest element
 At the end of the pass, places it where it belongs
 Efficiency is O(n2
), hence called a quadratic
sort
 Performs:
 O(n2
) comparisons
 O(n) exchanges (swaps)
7
 Idea:
 Find the smallest element in the array
 Exchange it with the element in the first position
 Find the second smallest element and exchange it with
the element in the second position
 Continue until the array is sorted
 Disadvantage:
 Running time depends only slightly on the amount of
order in the file
35 65 30 60 20 scan 0-4, smallest
20
swap 35 and 20
20 65 30 60 35 scan 1-4, smallest
30
swap 65 and 30
20 30 65 60 35 scan 2-4, smallest
35
swap 65 and 35
20 30 35 60 65 scan 3-4, smallest
60
swap 60 and 60
20 30 35 60 65 done
1. for fill = 0 to n-2 do // steps 2-6 form a
pass
2. set posMin to fill
3. for next = fill+1 to n-1 do
4. if item at next < item at posMin
5. set posMin to next
6. Exchange item at posMin with one at
fill
 Let A be a list of n numbers. Sorting A refers to the
operation of rearranging the elements of A So they
are in increasing order ,So that,
A[1]<A[2]<A[3]<……….<A[N]
 Example :-
List is- 8,4,19,2,7,13,5,16
After Sorting :-
List is-2,4,5,7,8,13,16,19
 Suppose the following numbers are stored in
an array A:-
53,21,65,27,70,8,99,1.
Pass1-21,53,65,27,70,8,99,1
21,53,65,27,70,8,99,1
21,53,27,65,70,8,99,1
21,53,27,65,70,8,99,1
21,53,27,65,8,70,99,1
21,53,27,65,8,70,99,1
21,53,27,65,8,70,1,99
Pass2- 21,53,27,65,8,70,1,99
21,53,27,65,8,70,1,99
21,27,53,65,8,70,1,99
21,27,53,65,8,70,1,99
21,27,53,8,65,70,1,99
21,27,53,8,65,70,1,99
21,27,53,8,65,1,70,99
Pass3- 21,27,53,8,65,1,70,99
21,27,8,53,65,1,70,99
21,27,8,53,1,65,70,99
Pass4- 21,27,8,53,1,65,70,99
21,8,27,53,1,65,70,99
21,8,27,1,53,65,70,99
Pass5- 21,8,27,1,53,65,70,99
8,21,27,1,53,65,70,99
8,21,1,27,53,65,70,99
Pass6- 8,21,1,27,53,65,70,99
8,1,21,27,53,65,70,99
Pass7- 1,8,21,27,53,65,70,99
SORTED LIST IS:- 1,8,21,27,53,65,70,99
Sorting techniques

More Related Content

What's hot

Sorting Algorithm
Sorting AlgorithmSorting Algorithm
Sorting Algorithm
Al Amin
 
Data Structures- Part4 basic sorting algorithms
Data Structures- Part4 basic sorting algorithmsData Structures- Part4 basic sorting algorithms
Data Structures- Part4 basic sorting algorithms
Abdullah Al-hazmy
 
Sorting algorithm
Sorting algorithmSorting algorithm
Sorting algorithm
Balaji Nangare
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
Trupti Agrawal
 
Sorting
SortingSorting
Sorting
Gopi Saiteja
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
Eleonora Ciceri
 
Sorting
SortingSorting
Data Structures & Algorithm design using C
Data Structures & Algorithm design using C Data Structures & Algorithm design using C
Data Structures & Algorithm design using C
Emertxe Information Technologies Pvt Ltd
 
Insertion Sorting
Insertion SortingInsertion Sorting
Insertion Sorting
FarihaHabib123
 
Searching & Sorting Algorithms
Searching & Sorting AlgorithmsSearching & Sorting Algorithms
Searching & Sorting Algorithms
Rahul Jamwal
 
Selection sort lab mannual
Selection sort lab mannualSelection sort lab mannual
Selection sort lab mannual
maamir farooq
 
Merge sort analysis and its real time applications
Merge sort analysis and its real time applicationsMerge sort analysis and its real time applications
Merge sort analysis and its real time applications
yazad dumasia
 
Sorting algorithums > Data Structures & Algorithums
Sorting algorithums  > Data Structures & AlgorithumsSorting algorithums  > Data Structures & Algorithums
Sorting algorithums > Data Structures & Algorithums
Ain-ul-Moiz Khawaja
 
3.9 external sorting
3.9 external sorting3.9 external sorting
3.9 external sorting
Krish_ver2
 
Sorting
SortingSorting
Sorting
Samsil Arefin
 
Lecture 3 data structures & algorithms - sorting techniques - http://techiem...
Lecture 3  data structures & algorithms - sorting techniques - http://techiem...Lecture 3  data structures & algorithms - sorting techniques - http://techiem...
Lecture 3 data structures & algorithms - sorting techniques - http://techiem...
Dharmendra Prasad
 
Sorting
SortingSorting
Sorting
Zaid Shabbir
 
Sorting
SortingSorting
Analisys of Selection Sort and Bubble Sort
Analisys of Selection Sort and Bubble SortAnalisys of Selection Sort and Bubble Sort
Analisys of Selection Sort and Bubble Sort
Humano Terricola
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
Mohammed Hussein
 

What's hot (20)

Sorting Algorithm
Sorting AlgorithmSorting Algorithm
Sorting Algorithm
 
Data Structures- Part4 basic sorting algorithms
Data Structures- Part4 basic sorting algorithmsData Structures- Part4 basic sorting algorithms
Data Structures- Part4 basic sorting algorithms
 
Sorting algorithm
Sorting algorithmSorting algorithm
Sorting algorithm
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
 
Sorting
SortingSorting
Sorting
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
 
Sorting
SortingSorting
Sorting
 
Data Structures & Algorithm design using C
Data Structures & Algorithm design using C Data Structures & Algorithm design using C
Data Structures & Algorithm design using C
 
Insertion Sorting
Insertion SortingInsertion Sorting
Insertion Sorting
 
Searching & Sorting Algorithms
Searching & Sorting AlgorithmsSearching & Sorting Algorithms
Searching & Sorting Algorithms
 
Selection sort lab mannual
Selection sort lab mannualSelection sort lab mannual
Selection sort lab mannual
 
Merge sort analysis and its real time applications
Merge sort analysis and its real time applicationsMerge sort analysis and its real time applications
Merge sort analysis and its real time applications
 
Sorting algorithums > Data Structures & Algorithums
Sorting algorithums  > Data Structures & AlgorithumsSorting algorithums  > Data Structures & Algorithums
Sorting algorithums > Data Structures & Algorithums
 
3.9 external sorting
3.9 external sorting3.9 external sorting
3.9 external sorting
 
Sorting
SortingSorting
Sorting
 
Lecture 3 data structures & algorithms - sorting techniques - http://techiem...
Lecture 3  data structures & algorithms - sorting techniques - http://techiem...Lecture 3  data structures & algorithms - sorting techniques - http://techiem...
Lecture 3 data structures & algorithms - sorting techniques - http://techiem...
 
Sorting
SortingSorting
Sorting
 
Sorting
SortingSorting
Sorting
 
Analisys of Selection Sort and Bubble Sort
Analisys of Selection Sort and Bubble SortAnalisys of Selection Sort and Bubble Sort
Analisys of Selection Sort and Bubble Sort
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
 

Similar to Sorting techniques

Unit vii sorting
Unit   vii sorting Unit   vii sorting
Unit vii sorting
Tribhuvan University
 
Sorting
SortingSorting
Sorting
Saharamily
 
Chapter 4 ds
Chapter 4 dsChapter 4 ds
Chapter 4 ds
Hanif Durad
 
Sorting
SortingSorting
searching in data structure.pptx
searching in data structure.pptxsearching in data structure.pptx
searching in data structure.pptx
chouguleamruta24
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
CHANDAN KUMAR
 
Unit6 C
Unit6 C Unit6 C
Unit6 C
arnold 7490
 
COMPUTER PROGRAMMING UNIT 1 Lecture 5
COMPUTER PROGRAMMING UNIT 1 Lecture 5COMPUTER PROGRAMMING UNIT 1 Lecture 5
COMPUTER PROGRAMMING UNIT 1 Lecture 5
Vishal Patil
 
Sorting
SortingSorting
Sorting and Searching Techniques
Sorting and Searching TechniquesSorting and Searching Techniques
Sorting and Searching Techniques
Prof Ansari
 
Selection sort
Selection sortSelection sort
Selection sort
asra khan
 
Lecture 13 data structures and algorithms
Lecture 13 data structures and algorithmsLecture 13 data structures and algorithms
Lecture 13 data structures and algorithms
Aakash deep Singhal
 
Counting sort(Non Comparison Sort)
Counting sort(Non Comparison Sort)Counting sort(Non Comparison Sort)
Counting sort(Non Comparison Sort)
Hossain Md Shakhawat
 
Counting Sort Lowerbound
Counting Sort LowerboundCounting Sort Lowerbound
Counting Sort Lowerbound
despicable me
 
Data Structure (MC501)
Data Structure (MC501)Data Structure (MC501)
Data Structure (MC501)
Kamal Singh Lodhi
 
lecture 10
lecture 10lecture 10
lecture 10
sajinsc
 
Sorting2
Sorting2Sorting2
Sorting2
Saurabh Mishra
 
Lec 03 - Sorting.pptx
Lec 03 - Sorting.pptxLec 03 - Sorting.pptx
Lec 03 - Sorting.pptx
Dr. Shaukat Wasi
 
Sorting
SortingSorting
Address calculation-sort
Address calculation-sortAddress calculation-sort
Address calculation-sort
Vasim Pathan
 

Similar to Sorting techniques (20)

Unit vii sorting
Unit   vii sorting Unit   vii sorting
Unit vii sorting
 
Sorting
SortingSorting
Sorting
 
Chapter 4 ds
Chapter 4 dsChapter 4 ds
Chapter 4 ds
 
Sorting
SortingSorting
Sorting
 
searching in data structure.pptx
searching in data structure.pptxsearching in data structure.pptx
searching in data structure.pptx
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
 
Unit6 C
Unit6 C Unit6 C
Unit6 C
 
COMPUTER PROGRAMMING UNIT 1 Lecture 5
COMPUTER PROGRAMMING UNIT 1 Lecture 5COMPUTER PROGRAMMING UNIT 1 Lecture 5
COMPUTER PROGRAMMING UNIT 1 Lecture 5
 
Sorting
SortingSorting
Sorting
 
Sorting and Searching Techniques
Sorting and Searching TechniquesSorting and Searching Techniques
Sorting and Searching Techniques
 
Selection sort
Selection sortSelection sort
Selection sort
 
Lecture 13 data structures and algorithms
Lecture 13 data structures and algorithmsLecture 13 data structures and algorithms
Lecture 13 data structures and algorithms
 
Counting sort(Non Comparison Sort)
Counting sort(Non Comparison Sort)Counting sort(Non Comparison Sort)
Counting sort(Non Comparison Sort)
 
Counting Sort Lowerbound
Counting Sort LowerboundCounting Sort Lowerbound
Counting Sort Lowerbound
 
Data Structure (MC501)
Data Structure (MC501)Data Structure (MC501)
Data Structure (MC501)
 
lecture 10
lecture 10lecture 10
lecture 10
 
Sorting2
Sorting2Sorting2
Sorting2
 
Lec 03 - Sorting.pptx
Lec 03 - Sorting.pptxLec 03 - Sorting.pptx
Lec 03 - Sorting.pptx
 
Sorting
SortingSorting
Sorting
 
Address calculation-sort
Address calculation-sortAddress calculation-sort
Address calculation-sort
 

More from Lovely Professional University

Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Lovely Professional University
 
Effort Estimation: Meaning, Problems with Estimation, Basis, Estimation Techn...
Effort Estimation: Meaning, Problems with Estimation, Basis, Estimation Techn...Effort Estimation: Meaning, Problems with Estimation, Basis, Estimation Techn...
Effort Estimation: Meaning, Problems with Estimation, Basis, Estimation Techn...
Lovely Professional University
 
Project Approach: Intro. Technical Plan, Choice of Process Models: Waterfall,...
Project Approach: Intro. Technical Plan, Choice of Process Models: Waterfall,...Project Approach: Intro. Technical Plan, Choice of Process Models: Waterfall,...
Project Approach: Intro. Technical Plan, Choice of Process Models: Waterfall,...
Lovely Professional University
 
Programme Management & Project Evaluation
Programme Management & Project EvaluationProgramme Management & Project Evaluation
Programme Management & Project Evaluation
Lovely Professional University
 
Step Wise Project Planning: Project Scope, Objectives, Infrastructure, Charac...
Step Wise Project Planning: Project Scope, Objectives, Infrastructure, Charac...Step Wise Project Planning: Project Scope, Objectives, Infrastructure, Charac...
Step Wise Project Planning: Project Scope, Objectives, Infrastructure, Charac...
Lovely Professional University
 
Introduction to Software Project Management:
Introduction to Software Project Management:Introduction to Software Project Management:
Introduction to Software Project Management:
Lovely Professional University
 
The HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup languageThe HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup language
Lovely Professional University
 
Working with JSON
Working with JSONWorking with JSON
Yargs Module
Yargs ModuleYargs Module
NODEMON Module
NODEMON ModuleNODEMON Module
Getting Input from User
Getting Input from UserGetting Input from User
Getting Input from User
Lovely Professional University
 
fs Module.pptx
fs Module.pptxfs Module.pptx
Transaction Processing in DBMS.pptx
Transaction Processing in DBMS.pptxTransaction Processing in DBMS.pptx
Transaction Processing in DBMS.pptx
Lovely Professional University
 
web_server_browser.ppt
web_server_browser.pptweb_server_browser.ppt
web_server_browser.ppt
Lovely Professional University
 
Web Server.pptx
Web Server.pptxWeb Server.pptx
Number System.pptx
Number System.pptxNumber System.pptx
Number System.pptx
Lovely Professional University
 
Programming Language.ppt
Programming Language.pptProgramming Language.ppt
Programming Language.ppt
Lovely Professional University
 
Information System.pptx
Information System.pptxInformation System.pptx
Information System.pptx
Lovely Professional University
 
Applications of Computer Science in Pharmacy-1.pptx
Applications of Computer Science in Pharmacy-1.pptxApplications of Computer Science in Pharmacy-1.pptx
Applications of Computer Science in Pharmacy-1.pptx
Lovely Professional University
 
Application of Computers in Pharmacy.pptx
Application of Computers in Pharmacy.pptxApplication of Computers in Pharmacy.pptx
Application of Computers in Pharmacy.pptx
Lovely Professional University
 

More from Lovely Professional University (20)

Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
 
Effort Estimation: Meaning, Problems with Estimation, Basis, Estimation Techn...
Effort Estimation: Meaning, Problems with Estimation, Basis, Estimation Techn...Effort Estimation: Meaning, Problems with Estimation, Basis, Estimation Techn...
Effort Estimation: Meaning, Problems with Estimation, Basis, Estimation Techn...
 
Project Approach: Intro. Technical Plan, Choice of Process Models: Waterfall,...
Project Approach: Intro. Technical Plan, Choice of Process Models: Waterfall,...Project Approach: Intro. Technical Plan, Choice of Process Models: Waterfall,...
Project Approach: Intro. Technical Plan, Choice of Process Models: Waterfall,...
 
Programme Management & Project Evaluation
Programme Management & Project EvaluationProgramme Management & Project Evaluation
Programme Management & Project Evaluation
 
Step Wise Project Planning: Project Scope, Objectives, Infrastructure, Charac...
Step Wise Project Planning: Project Scope, Objectives, Infrastructure, Charac...Step Wise Project Planning: Project Scope, Objectives, Infrastructure, Charac...
Step Wise Project Planning: Project Scope, Objectives, Infrastructure, Charac...
 
Introduction to Software Project Management:
Introduction to Software Project Management:Introduction to Software Project Management:
Introduction to Software Project Management:
 
The HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup languageThe HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup language
 
Working with JSON
Working with JSONWorking with JSON
Working with JSON
 
Yargs Module
Yargs ModuleYargs Module
Yargs Module
 
NODEMON Module
NODEMON ModuleNODEMON Module
NODEMON Module
 
Getting Input from User
Getting Input from UserGetting Input from User
Getting Input from User
 
fs Module.pptx
fs Module.pptxfs Module.pptx
fs Module.pptx
 
Transaction Processing in DBMS.pptx
Transaction Processing in DBMS.pptxTransaction Processing in DBMS.pptx
Transaction Processing in DBMS.pptx
 
web_server_browser.ppt
web_server_browser.pptweb_server_browser.ppt
web_server_browser.ppt
 
Web Server.pptx
Web Server.pptxWeb Server.pptx
Web Server.pptx
 
Number System.pptx
Number System.pptxNumber System.pptx
Number System.pptx
 
Programming Language.ppt
Programming Language.pptProgramming Language.ppt
Programming Language.ppt
 
Information System.pptx
Information System.pptxInformation System.pptx
Information System.pptx
 
Applications of Computer Science in Pharmacy-1.pptx
Applications of Computer Science in Pharmacy-1.pptxApplications of Computer Science in Pharmacy-1.pptx
Applications of Computer Science in Pharmacy-1.pptx
 
Application of Computers in Pharmacy.pptx
Application of Computers in Pharmacy.pptxApplication of Computers in Pharmacy.pptx
Application of Computers in Pharmacy.pptx
 

Recently uploaded

Levelised Cost of Hydrogen (LCOH) Calculator Manual
Levelised Cost of Hydrogen  (LCOH) Calculator ManualLevelised Cost of Hydrogen  (LCOH) Calculator Manual
Levelised Cost of Hydrogen (LCOH) Calculator Manual
Massimo Talia
 
OOPS_Lab_Manual - programs using C++ programming language
OOPS_Lab_Manual - programs using C++ programming languageOOPS_Lab_Manual - programs using C++ programming language
OOPS_Lab_Manual - programs using C++ programming language
PreethaV16
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
21UME003TUSHARDEB
 
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdfAsymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
felixwold
 
Call Girls Chennai +91-8824825030 Vip Call Girls Chennai
Call Girls Chennai +91-8824825030 Vip Call Girls ChennaiCall Girls Chennai +91-8824825030 Vip Call Girls Chennai
Call Girls Chennai +91-8824825030 Vip Call Girls Chennai
paraasingh12 #V08
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
uqyfuc
 
Determination of Equivalent Circuit parameters and performance characteristic...
Determination of Equivalent Circuit parameters and performance characteristic...Determination of Equivalent Circuit parameters and performance characteristic...
Determination of Equivalent Circuit parameters and performance characteristic...
pvpriya2
 
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
ijseajournal
 
FULL STACK PROGRAMMING - Both Front End and Back End
FULL STACK PROGRAMMING - Both Front End and Back EndFULL STACK PROGRAMMING - Both Front End and Back End
FULL STACK PROGRAMMING - Both Front End and Back End
PreethaV16
 
Object Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOADObject Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOAD
PreethaV16
 
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Transcat
 
Butterfly Valves Manufacturer (LBF Series).pdf
Butterfly Valves Manufacturer (LBF Series).pdfButterfly Valves Manufacturer (LBF Series).pdf
Butterfly Valves Manufacturer (LBF Series).pdf
Lubi Valves
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
ElakkiaU
 
Digital Image Processing Unit -2 Notes complete
Digital Image Processing Unit -2 Notes completeDigital Image Processing Unit -2 Notes complete
Digital Image Processing Unit -2 Notes complete
shubhamsaraswat8740
 
Assistant Engineer (Chemical) Interview Questions.pdf
Assistant Engineer (Chemical) Interview Questions.pdfAssistant Engineer (Chemical) Interview Questions.pdf
Assistant Engineer (Chemical) Interview Questions.pdf
Seetal Daas
 
Accident detection system project report.pdf
Accident detection system project report.pdfAccident detection system project report.pdf
Accident detection system project report.pdf
Kamal Acharya
 
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
upoux
 
DESIGN AND MANUFACTURE OF CEILING BOARD USING SAWDUST AND WASTE CARTON MATERI...
DESIGN AND MANUFACTURE OF CEILING BOARD USING SAWDUST AND WASTE CARTON MATERI...DESIGN AND MANUFACTURE OF CEILING BOARD USING SAWDUST AND WASTE CARTON MATERI...
DESIGN AND MANUFACTURE OF CEILING BOARD USING SAWDUST AND WASTE CARTON MATERI...
OKORIE1
 
AI in customer support Use cases solutions development and implementation.pdf
AI in customer support Use cases solutions development and implementation.pdfAI in customer support Use cases solutions development and implementation.pdf
AI in customer support Use cases solutions development and implementation.pdf
mahaffeycheryld
 

Recently uploaded (20)

Levelised Cost of Hydrogen (LCOH) Calculator Manual
Levelised Cost of Hydrogen  (LCOH) Calculator ManualLevelised Cost of Hydrogen  (LCOH) Calculator Manual
Levelised Cost of Hydrogen (LCOH) Calculator Manual
 
OOPS_Lab_Manual - programs using C++ programming language
OOPS_Lab_Manual - programs using C++ programming languageOOPS_Lab_Manual - programs using C++ programming language
OOPS_Lab_Manual - programs using C++ programming language
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
 
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdfAsymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
 
Call Girls Chennai +91-8824825030 Vip Call Girls Chennai
Call Girls Chennai +91-8824825030 Vip Call Girls ChennaiCall Girls Chennai +91-8824825030 Vip Call Girls Chennai
Call Girls Chennai +91-8824825030 Vip Call Girls Chennai
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
Determination of Equivalent Circuit parameters and performance characteristic...
Determination of Equivalent Circuit parameters and performance characteristic...Determination of Equivalent Circuit parameters and performance characteristic...
Determination of Equivalent Circuit parameters and performance characteristic...
 
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
 
FULL STACK PROGRAMMING - Both Front End and Back End
FULL STACK PROGRAMMING - Both Front End and Back EndFULL STACK PROGRAMMING - Both Front End and Back End
FULL STACK PROGRAMMING - Both Front End and Back End
 
Object Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOADObject Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOAD
 
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
 
Butterfly Valves Manufacturer (LBF Series).pdf
Butterfly Valves Manufacturer (LBF Series).pdfButterfly Valves Manufacturer (LBF Series).pdf
Butterfly Valves Manufacturer (LBF Series).pdf
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
 
Digital Image Processing Unit -2 Notes complete
Digital Image Processing Unit -2 Notes completeDigital Image Processing Unit -2 Notes complete
Digital Image Processing Unit -2 Notes complete
 
Assistant Engineer (Chemical) Interview Questions.pdf
Assistant Engineer (Chemical) Interview Questions.pdfAssistant Engineer (Chemical) Interview Questions.pdf
Assistant Engineer (Chemical) Interview Questions.pdf
 
Accident detection system project report.pdf
Accident detection system project report.pdfAccident detection system project report.pdf
Accident detection system project report.pdf
 
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
 
DESIGN AND MANUFACTURE OF CEILING BOARD USING SAWDUST AND WASTE CARTON MATERI...
DESIGN AND MANUFACTURE OF CEILING BOARD USING SAWDUST AND WASTE CARTON MATERI...DESIGN AND MANUFACTURE OF CEILING BOARD USING SAWDUST AND WASTE CARTON MATERI...
DESIGN AND MANUFACTURE OF CEILING BOARD USING SAWDUST AND WASTE CARTON MATERI...
 
AI in customer support Use cases solutions development and implementation.pdf
AI in customer support Use cases solutions development and implementation.pdfAI in customer support Use cases solutions development and implementation.pdf
AI in customer support Use cases solutions development and implementation.pdf
 

Sorting techniques

  • 1. 1
  • 2.  Introduction  Sorting  Selection Sort  Bubble Sort  Bubble Sorting:- Example
  • 3.  Sorting and searching are fundamental operations in computer science.  Sorting refers to operation of arranging data in some given order , such as increasing or decreasing ,with numerical data or with character data.  Generally, collections of data are presented in a sorted manner.
  • 4.  Let A be a list of n elements A1,A2,……An in Memory. Sorting A refers to the operation of rearranging the contents of A so that they are in increasing in order, so that A1<A2<A3<…..<An
  • 5.  Sorting = ordering.  Sorted = ordered based on a particular way.  Examples of Sorting:  Words in a dictionary are sorted (and case distinctions are ignored).  Files in a directory are often listed in sorted order.  The index of a book is sorted (and case distinctions are ignored).
  • 6.  A relatively easy to understand algorithm  Sorts an array in passes  Each pass selects the next smallest element  At the end of the pass, places it where it belongs  Efficiency is O(n2 ), hence called a quadratic sort  Performs:  O(n2 ) comparisons  O(n) exchanges (swaps)
  • 7. 7  Idea:  Find the smallest element in the array  Exchange it with the element in the first position  Find the second smallest element and exchange it with the element in the second position  Continue until the array is sorted  Disadvantage:  Running time depends only slightly on the amount of order in the file
  • 8. 35 65 30 60 20 scan 0-4, smallest 20 swap 35 and 20 20 65 30 60 35 scan 1-4, smallest 30 swap 65 and 30 20 30 65 60 35 scan 2-4, smallest 35 swap 65 and 35 20 30 35 60 65 scan 3-4, smallest 60 swap 60 and 60 20 30 35 60 65 done
  • 9. 1. for fill = 0 to n-2 do // steps 2-6 form a pass 2. set posMin to fill 3. for next = fill+1 to n-1 do 4. if item at next < item at posMin 5. set posMin to next 6. Exchange item at posMin with one at fill
  • 10.  Let A be a list of n numbers. Sorting A refers to the operation of rearranging the elements of A So they are in increasing order ,So that, A[1]<A[2]<A[3]<……….<A[N]  Example :- List is- 8,4,19,2,7,13,5,16 After Sorting :- List is-2,4,5,7,8,13,16,19
  • 11.  Suppose the following numbers are stored in an array A:- 53,21,65,27,70,8,99,1. Pass1-21,53,65,27,70,8,99,1 21,53,65,27,70,8,99,1 21,53,27,65,70,8,99,1 21,53,27,65,70,8,99,1 21,53,27,65,8,70,99,1 21,53,27,65,8,70,99,1 21,53,27,65,8,70,1,99
  • 13. Pass4- 21,27,8,53,1,65,70,99 21,8,27,53,1,65,70,99 21,8,27,1,53,65,70,99 Pass5- 21,8,27,1,53,65,70,99 8,21,27,1,53,65,70,99 8,21,1,27,53,65,70,99 Pass6- 8,21,1,27,53,65,70,99 8,1,21,27,53,65,70,99 Pass7- 1,8,21,27,53,65,70,99 SORTED LIST IS:- 1,8,21,27,53,65,70,99