SlideShare a Scribd company logo
An algorithm is a finite collection of well defined steps
to solve
A particular problem. An algorithm Is a finite sequence
of instructions,
Logic, step by step process for solving a problem.
Sorting technique to arranging data in a
particular format. Sorting algorithm specifies
the
Way to arrange data in a particular order. Most
common are numerical or lexicograpical order.
Sorting is also used to represent data in more
readable formats.
Telephone Directory – Telephone directory keeps
telephone No. of people sorted on their
Names. So that names can be searched.
Dictionary – Dictionary keeps words in
alphabetical order so that searching of any work
becomes easy.
Bubble Sort is a simple sorting algorithm. This
sorting algorithm is comparison
Based algorithm in which each pair of
adjacent elements is compared & elements
Are swapped if they are not in order. This
algorithm is not suitable for large data
Sets as its average and worst case complexity.
We take an unsorted array for our example:
14 33 27 35 10
14
14
14
14
14
14
14
14
1433
33
33
27 33
27
27
27
35
35
35
35
10
10
10
10
27
27
27
27
27
33
33
33
33
10
35
35
35
10
35
10
10
10
35
33
14
14
10
10
27
27 33
33
35
35
This is a in-place comparison based sorting
algorithm. Here, a sub-list is always sorted.
For example, the lower part of an array is
maintained to be sorted. The array is
searched
Sequentially and unsorted items are moved
and inserted into sorted sub-list.
14 33 27 3510
14
14
14
14
14
14
14
14
1433
33
33
33 27
27
27
27
10
10
10
10
35
35
35
35
27
27
27
27
27
33
33
33
10
10
10
10
10
33
35
35
35
35
35
33
We take an unsorted array for our example.
14
14
14
10
10
10
27
27
27
33
33
33
35
35
35
Selection sort is a simple sorting algorithm .
This sorting algorithm is a in-place
Comparison based algorithm in which the
list is divided into two parts, sorted
Part at left end and unsorted part at right
end. intially end sorted part is empty
And unsorted part is entire list.
We take the depicted array for our example :
14 33 27 10 35
14
10
10
10
10
10
10
10
1033
33
33
33 27
27
27
27
10
14
14
14
35
35
35
35
14
14
14
14
14
27
27
27
19
19
33
33
33
33
35
35
35
35
35
33
19 19
19
19
27
27
19
19
19
19
10
10
10
10
10
14
14
14
14
14
19
19
19
19
19
27
27
27
27
33
35
35
35
33
27
33
33
33
35
35
Merge Sort is a sorting technique based
on divide & conquer technique. With
worst case time complexity being
respected algorithms. Merge Sort first
divides the array into equal halves &
Then combines them in a sorted manner.
To understand merge sort, we take an unsorted array as depicted below.
14 33 27 10 35 19 42 44
35 19 42 4414 33 27 10
14 33 27 10 35 19 42 44
14 33 27 10 35 19 42 44
14 33 10 27 19 35 42 44
Combine Them into another list
10 14 33 27 19 35 42 44
After final merging, the list should look like this :
10 14 19 27 33 35 42 44
Quick sort is a highly efficient sorting
algorithm and is based on partitioning of array
Of data into smaller arrays. The quick sort
partitions an array and then calls itself
recursively twice to sort the resulting two sub
arrays. This algorithm is quite efficient for
large size data sets its average & worst case
complexity are of 0.
The below given image representation explains how to find
pivot value in the way.
10 42 35 33 31 27 26 19 14 44
10 14 19 26 27 31 33 35 42 44
Linear search is a very simple search algorithm. In
this type search, a sequential
search is made over all items one by one. Every
items is checked & if a match founds them
Particular item is returned otherwise search
continues till the end of the data collection.
Suppose that we find 33 in array element
Linear Search
10 14 19 26 27 31 33 35 42 44
=
33
10 14 19 26 27 31 33 35 42 44
Binary search is a fast search algorithm
with run-time complexity of 0 (log n) .
This search algorithm works on the
principle of divide & compare. For this
algorithm to work properly the data
collection should be in sorted form.
The below given is our sorted array and assume that we need to search location
Of value 31 using binary search.
10 14 19 26 27 31 33 35 42 44
0 1 2 3 4 5 6 7 8 9
First, we shall determine the half of the array by using this formula-
Mid = low + (high – low) / 2
Here it is, 0+(9-0) / 2 = 4(integer value of 4.5). So 4 is the mid of array.
10 14 19 26 27 31 33 35 42 44
0 1 2 3 4 5 6 7 8 9
We change our low to mid + 1 and final the new value again.
Low = mid + 1
Mid = low + (high – low) / 2
Our new mid 7 now. We compare the value stored at location 7 with our target value 31.
10 14 19 26 27 31 33 35 42 44
0 1 2 3 4 5 6 7 8 9
The value stored at location 7 is not match, rather it is less that what we are looking for.
So the value must be in lower part from this location.
10 14 19 26 27 31 33 35 42 44
0 1 2 3 4 5 6 7 8 9
So we calculate the mid again. This time is 5.
10 14 19 26 27 31 33 35 42 44
0 1 2 3 4 5 6 7 8 9
We compare the value stored ad location 5 with our target value. We find
that is a match.
10 14 19 26 27 31 33 35 42 44
0 1 2 3 4 5 6 7 8 9
We conclude that the target value 31 is stored at location 5.
End Of The Moment

More Related Content

What's hot

Linear search-and-binary-search
Linear search-and-binary-searchLinear search-and-binary-search
Linear search-and-binary-search
International Islamic University
 
Algorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsAlgorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching Algorithms
Mohamed Loey
 
Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure
Janki Shah
 
Selection sort
Selection sortSelection sort
Selection sort
stella D
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
Mohammed Hussein
 
Bubble Sort Algorithm Presentation
Bubble Sort Algorithm Presentation Bubble Sort Algorithm Presentation
Bubble Sort Algorithm Presentation
AhmedAlbutty
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMS
Gokul Hari
 
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data Structure
Dharita Chokshi
 
Searching
SearchingSearching
Searching
Ashim Lamichhane
 
Searching & Sorting Algorithms
Searching & Sorting AlgorithmsSearching & Sorting Algorithms
Searching & Sorting Algorithms
Rahul Jamwal
 
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And AlgorithmSearching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm
03446940736
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysissumitbardhan
 
Insertion sort
Insertion sortInsertion sort
Insertion sortMYER301
 
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data Structures
SHAKOOR AB
 
Bubble sort
Bubble sortBubble sort
Bubble sort
Rashmi R Upadhya
 
Quick sort
Quick sortQuick sort
Quick sort
Dhruv Sabalpara
 
Selection sorting
Selection sortingSelection sorting
Selection sorting
Himanshu Kesharwani
 
Linear Search Presentation
Linear Search PresentationLinear Search Presentation
Linear Search Presentation
Markajul Hasnain Alif
 
Linear and Binary search
Linear and Binary searchLinear and Binary search
Linear and Binary search
Nisha Soms
 

What's hot (20)

Linear search-and-binary-search
Linear search-and-binary-searchLinear search-and-binary-search
Linear search-and-binary-search
 
Algorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsAlgorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching Algorithms
 
Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure
 
Selection sort
Selection sortSelection sort
Selection sort
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
 
Bubble Sort Algorithm Presentation
Bubble Sort Algorithm Presentation Bubble Sort Algorithm Presentation
Bubble Sort Algorithm Presentation
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMS
 
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data Structure
 
Searching
SearchingSearching
Searching
 
Selection sort
Selection sortSelection sort
Selection sort
 
Searching & Sorting Algorithms
Searching & Sorting AlgorithmsSearching & Sorting Algorithms
Searching & Sorting Algorithms
 
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And AlgorithmSearching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
 
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data Structures
 
Bubble sort
Bubble sortBubble sort
Bubble sort
 
Quick sort
Quick sortQuick sort
Quick sort
 
Selection sorting
Selection sortingSelection sorting
Selection sorting
 
Linear Search Presentation
Linear Search PresentationLinear Search Presentation
Linear Search Presentation
 
Linear and Binary search
Linear and Binary searchLinear and Binary search
Linear and Binary search
 

Similar to PPT On Sorting And Searching Concepts In Data Structure | In Programming Language |

advanced searching and sorting.pdf
advanced searching and sorting.pdfadvanced searching and sorting.pdf
advanced searching and sorting.pdf
haramaya university
 
Chapter 11 - Sorting and Searching
Chapter 11 - Sorting and SearchingChapter 11 - Sorting and Searching
Chapter 11 - Sorting and Searching
Eduardo Bergavera
 
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 and searching.pptx
sorting and searching.pptxsorting and searching.pptx
sorting and searching.pptx
ParagAhir1
 
Linear and Binary Search
Linear and Binary SearchLinear and Binary Search
Linear and Binary Search
WinNie Sjr
 
Data structure using c module 3
Data structure using c module 3Data structure using c module 3
Data structure using c module 3
smruti sarangi
 
Sorting algorithums > Data Structures & Algorithums
Sorting algorithums  > Data Structures & AlgorithumsSorting algorithums  > Data Structures & Algorithums
Sorting algorithums > Data Structures & AlgorithumsAin-ul-Moiz Khawaja
 
Algorithm & data structures lec4&5
Algorithm & data structures lec4&5Algorithm & data structures lec4&5
Algorithm & data structures lec4&5Abdul Khan
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
CHANDAN KUMAR
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arrays
maamir farooq
 
Algorithm 8th lecture linear & binary search(2).pptx
Algorithm 8th lecture linear & binary search(2).pptxAlgorithm 8th lecture linear & binary search(2).pptx
Algorithm 8th lecture linear & binary search(2).pptx
Aftabali702240
 
sorting.pptx
sorting.pptxsorting.pptx
sorting.pptx
DrRanjeetKumar51721
 
Analysis of Algorithm - Binary Search.pptx
Analysis of Algorithm - Binary Search.pptxAnalysis of Algorithm - Binary Search.pptx
Analysis of Algorithm - Binary Search.pptx
Maulana Abul Kalam Azad University of Technology
 
Dsa – data structure and algorithms searching
Dsa – data structure and algorithms   searchingDsa – data structure and algorithms   searching
Dsa – data structure and algorithms searching
sajinis3
 
Sorting Data structure And Algorithm.pptx
Sorting Data structure And Algorithm.pptxSorting Data structure And Algorithm.pptx
Sorting Data structure And Algorithm.pptx
subhanalichand514
 
Sorting method data structure
Sorting method data structureSorting method data structure
Sorting method data structure
sunilchute1
 
(Data Structure) Chapter11 searching & sorting
(Data Structure) Chapter11 searching & sorting(Data Structure) Chapter11 searching & sorting
(Data Structure) Chapter11 searching & sortingFadhil Ismail
 
Searching Sorting
Searching SortingSearching Sorting
Searching Sortingguest2cb109
 
Chapter3.pptx
Chapter3.pptxChapter3.pptx
Chapter3.pptx
ASMAALWADEE2
 

Similar to PPT On Sorting And Searching Concepts In Data Structure | In Programming Language | (20)

advanced searching and sorting.pdf
advanced searching and sorting.pdfadvanced searching and sorting.pdf
advanced searching and sorting.pdf
 
Chapter 11 - Sorting and Searching
Chapter 11 - Sorting and SearchingChapter 11 - Sorting and Searching
Chapter 11 - Sorting and Searching
 
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 and searching.pptx
sorting and searching.pptxsorting and searching.pptx
sorting and searching.pptx
 
Linear and Binary Search
Linear and Binary SearchLinear and Binary Search
Linear and Binary Search
 
Data structure using c module 3
Data structure using c module 3Data structure using c module 3
Data structure using c module 3
 
Sorting algorithums > Data Structures & Algorithums
Sorting algorithums  > Data Structures & AlgorithumsSorting algorithums  > Data Structures & Algorithums
Sorting algorithums > Data Structures & Algorithums
 
Algorithm & data structures lec4&5
Algorithm & data structures lec4&5Algorithm & data structures lec4&5
Algorithm & data structures lec4&5
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arrays
 
Algorithm 8th lecture linear & binary search(2).pptx
Algorithm 8th lecture linear & binary search(2).pptxAlgorithm 8th lecture linear & binary search(2).pptx
Algorithm 8th lecture linear & binary search(2).pptx
 
sorting.pptx
sorting.pptxsorting.pptx
sorting.pptx
 
Unit v data structure-converted
Unit  v data structure-convertedUnit  v data structure-converted
Unit v data structure-converted
 
Analysis of Algorithm - Binary Search.pptx
Analysis of Algorithm - Binary Search.pptxAnalysis of Algorithm - Binary Search.pptx
Analysis of Algorithm - Binary Search.pptx
 
Dsa – data structure and algorithms searching
Dsa – data structure and algorithms   searchingDsa – data structure and algorithms   searching
Dsa – data structure and algorithms searching
 
Sorting Data structure And Algorithm.pptx
Sorting Data structure And Algorithm.pptxSorting Data structure And Algorithm.pptx
Sorting Data structure And Algorithm.pptx
 
Sorting method data structure
Sorting method data structureSorting method data structure
Sorting method data structure
 
(Data Structure) Chapter11 searching & sorting
(Data Structure) Chapter11 searching & sorting(Data Structure) Chapter11 searching & sorting
(Data Structure) Chapter11 searching & sorting
 
Searching Sorting
Searching SortingSearching Sorting
Searching Sorting
 
Chapter3.pptx
Chapter3.pptxChapter3.pptx
Chapter3.pptx
 

More from Umesh Kumar

Payroll System in india
Payroll System in india Payroll System in india
Payroll System in india
Umesh Kumar
 
What Is Robotics & It's Simulation ?
What Is Robotics & It's Simulation ?What Is Robotics & It's Simulation ?
What Is Robotics & It's Simulation ?
Umesh Kumar
 
PPT On INTERNET
PPT On INTERNETPPT On INTERNET
PPT On INTERNET
Umesh Kumar
 
PPT On MS-Access 2007 | Full Concepts |
PPT On MS-Access 2007 | Full Concepts |PPT On MS-Access 2007 | Full Concepts |
PPT On MS-Access 2007 | Full Concepts |
Umesh Kumar
 
PPT On Ports | Full Concept | Ports In Depth
PPT On Ports | Full Concept | Ports In DepthPPT On Ports | Full Concept | Ports In Depth
PPT On Ports | Full Concept | Ports In Depth
Umesh Kumar
 
PPT On Microsoft Excel 2007 Full Information.
PPT On Microsoft Excel 2007 Full Information.PPT On Microsoft Excel 2007 Full Information.
PPT On Microsoft Excel 2007 Full Information.
Umesh Kumar
 
PPT On Computer Generations
PPT On Computer GenerationsPPT On Computer Generations
PPT On Computer Generations
Umesh Kumar
 

More from Umesh Kumar (7)

Payroll System in india
Payroll System in india Payroll System in india
Payroll System in india
 
What Is Robotics & It's Simulation ?
What Is Robotics & It's Simulation ?What Is Robotics & It's Simulation ?
What Is Robotics & It's Simulation ?
 
PPT On INTERNET
PPT On INTERNETPPT On INTERNET
PPT On INTERNET
 
PPT On MS-Access 2007 | Full Concepts |
PPT On MS-Access 2007 | Full Concepts |PPT On MS-Access 2007 | Full Concepts |
PPT On MS-Access 2007 | Full Concepts |
 
PPT On Ports | Full Concept | Ports In Depth
PPT On Ports | Full Concept | Ports In DepthPPT On Ports | Full Concept | Ports In Depth
PPT On Ports | Full Concept | Ports In Depth
 
PPT On Microsoft Excel 2007 Full Information.
PPT On Microsoft Excel 2007 Full Information.PPT On Microsoft Excel 2007 Full Information.
PPT On Microsoft Excel 2007 Full Information.
 
PPT On Computer Generations
PPT On Computer GenerationsPPT On Computer Generations
PPT On Computer Generations
 

Recently uploaded

Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 

Recently uploaded (20)

Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 

PPT On Sorting And Searching Concepts In Data Structure | In Programming Language |

  • 1.
  • 2. An algorithm is a finite collection of well defined steps to solve A particular problem. An algorithm Is a finite sequence of instructions, Logic, step by step process for solving a problem.
  • 3.
  • 4.
  • 5. Sorting technique to arranging data in a particular format. Sorting algorithm specifies the Way to arrange data in a particular order. Most common are numerical or lexicograpical order. Sorting is also used to represent data in more readable formats.
  • 6. Telephone Directory – Telephone directory keeps telephone No. of people sorted on their Names. So that names can be searched. Dictionary – Dictionary keeps words in alphabetical order so that searching of any work becomes easy.
  • 7. Bubble Sort is a simple sorting algorithm. This sorting algorithm is comparison Based algorithm in which each pair of adjacent elements is compared & elements Are swapped if they are not in order. This algorithm is not suitable for large data Sets as its average and worst case complexity.
  • 8. We take an unsorted array for our example: 14 33 27 35 10 14 14 14 14 14 14 14 14 1433 33 33 27 33 27 27 27 35 35 35 35 10 10 10 10 27 27 27 27 27 33 33 33 33 10 35 35 35 10 35 10 10 10 35 33
  • 10. This is a in-place comparison based sorting algorithm. Here, a sub-list is always sorted. For example, the lower part of an array is maintained to be sorted. The array is searched Sequentially and unsorted items are moved and inserted into sorted sub-list.
  • 11. 14 33 27 3510 14 14 14 14 14 14 14 14 1433 33 33 33 27 27 27 27 10 10 10 10 35 35 35 35 27 27 27 27 27 33 33 33 10 10 10 10 10 33 35 35 35 35 35 33 We take an unsorted array for our example.
  • 13. Selection sort is a simple sorting algorithm . This sorting algorithm is a in-place Comparison based algorithm in which the list is divided into two parts, sorted Part at left end and unsorted part at right end. intially end sorted part is empty And unsorted part is entire list.
  • 14. We take the depicted array for our example : 14 33 27 10 35 14 10 10 10 10 10 10 10 1033 33 33 33 27 27 27 27 10 14 14 14 35 35 35 35 14 14 14 14 14 27 27 27 19 19 33 33 33 33 35 35 35 35 35 33 19 19 19 19 27 27 19 19 19 19
  • 16. Merge Sort is a sorting technique based on divide & conquer technique. With worst case time complexity being respected algorithms. Merge Sort first divides the array into equal halves & Then combines them in a sorted manner.
  • 17. To understand merge sort, we take an unsorted array as depicted below. 14 33 27 10 35 19 42 44 35 19 42 4414 33 27 10 14 33 27 10 35 19 42 44 14 33 27 10 35 19 42 44 14 33 10 27 19 35 42 44 Combine Them into another list
  • 18. 10 14 33 27 19 35 42 44 After final merging, the list should look like this : 10 14 19 27 33 35 42 44
  • 19. Quick sort is a highly efficient sorting algorithm and is based on partitioning of array Of data into smaller arrays. The quick sort partitions an array and then calls itself recursively twice to sort the resulting two sub arrays. This algorithm is quite efficient for large size data sets its average & worst case complexity are of 0.
  • 20. The below given image representation explains how to find pivot value in the way. 10 42 35 33 31 27 26 19 14 44 10 14 19 26 27 31 33 35 42 44
  • 21.
  • 22. Linear search is a very simple search algorithm. In this type search, a sequential search is made over all items one by one. Every items is checked & if a match founds them Particular item is returned otherwise search continues till the end of the data collection.
  • 23. Suppose that we find 33 in array element Linear Search 10 14 19 26 27 31 33 35 42 44 = 33 10 14 19 26 27 31 33 35 42 44
  • 24. Binary search is a fast search algorithm with run-time complexity of 0 (log n) . This search algorithm works on the principle of divide & compare. For this algorithm to work properly the data collection should be in sorted form.
  • 25. The below given is our sorted array and assume that we need to search location Of value 31 using binary search. 10 14 19 26 27 31 33 35 42 44 0 1 2 3 4 5 6 7 8 9 First, we shall determine the half of the array by using this formula- Mid = low + (high – low) / 2 Here it is, 0+(9-0) / 2 = 4(integer value of 4.5). So 4 is the mid of array. 10 14 19 26 27 31 33 35 42 44 0 1 2 3 4 5 6 7 8 9
  • 26. We change our low to mid + 1 and final the new value again. Low = mid + 1 Mid = low + (high – low) / 2 Our new mid 7 now. We compare the value stored at location 7 with our target value 31. 10 14 19 26 27 31 33 35 42 44 0 1 2 3 4 5 6 7 8 9 The value stored at location 7 is not match, rather it is less that what we are looking for. So the value must be in lower part from this location. 10 14 19 26 27 31 33 35 42 44 0 1 2 3 4 5 6 7 8 9
  • 27. So we calculate the mid again. This time is 5. 10 14 19 26 27 31 33 35 42 44 0 1 2 3 4 5 6 7 8 9 We compare the value stored ad location 5 with our target value. We find that is a match. 10 14 19 26 27 31 33 35 42 44 0 1 2 3 4 5 6 7 8 9 We conclude that the target value 31 is stored at location 5.
  • 28.
  • 29. End Of The Moment