SlideShare a Scribd company logo
An Enhancement of Major
Sorting Algorithms
Group 7 Roll No
Akber Ali 1406
Assad Ali 1407
Qasim Ali 1425
Touseef Khadim 1427
Discuss
 Enhanced selection sort
 Enhanced bubble sort
 Selection sort
 Bubble sort
 Number of swaps
 Time complexity.
Enhanced Selection Sort
 Inserting an array of elements and sorting these elements
in the same array (in-place) by finding the maximum
element and exchanging it with the last element, and
then decreasing the size of the array by one for next call.
 In fact, the Enhanced Selection Sort (ESS) algorithm is an
enhancement to the SS algorithm in decreasing number of
swap operations, making the algorithm to be data
dependent, and in making it stable.
Procedures
 Inserting all elements of the array.
 Calling the “Enhanced Selection Sort” function with passing the array and its size as
parameters.
 Finding the maximum element in the array.
 And swapping it with the last index of the same array.
 Decreasing the size of the array by one.
 Calling the “Enhanced Selection Sort” function recursively.
 The size of the array is decremented by one after each call of the “Enhanced Selection
Sort” function.
 Operationally, the (size) after the first call became (size-1), and after the second call
became (size-2), and so on
Pseudo code
 1- If size > 1 then
 2- var index, temp, max
 3- index := size-1
 4- max := array(index)
 5- for a:= 0 to size-2 do
 6- if array(a) ≥ max then
 7- max := array(a)
 8- index := a
 9- end if
 10- end for
 11- if index ≠ size-1 then
 12- temp := array(size-1)
 13- array(size-1) := max
 14- array(index) := temp
 15- end if
 16- size := size-1
 17- return Enhanced Selection Sort (array , size)
 18- else
 19- return array
 20- end if
Analysis
 a) In the best-case scenario; if the input array is already sorted (ascending order), then there is no need
to make swapping, since each element is in the correct place.
 b) In the average-case scenario; if the input array is sorted in reverse (descending order), then the total
number of swapping operations is: floor of (n/2). Since swapping the maximum value with the last
element means that the maximum and the minimum values are in the correct places. For example, if
we have a descending sorted array as follows: Then the algorithm will swap the first element (max) with the
last element, as follows:
 Since the last element before swapping was the minimum value, it is after swapping got in the correct
place and cannot be the maximum value in any of the next comparisons. In the next comparison, the
second element now is the maximum value and it will be swapped with the fourth (size-1)the element.
 The array now is sorted and the algorithm required two swap operations to sort the input array of five
elements. That means, the swapping operations that are needed to sort a descending sorted array is
floor of (n/2).
 c) In the worst case; if the input array is unsorted neither ascending nor descending, then the required
swapping operations are approximately operations.
Enhanced Bubble Sort
 The proposed algorithm is considered as an enhancement to the original
Bubble sort algorithm and it works as follows:
 Inserting an array of elements and sorting these elements in the same array
(in place) by finding the minimum and the maximum elements and exchanging
 The minimum with the first element and the maximum
 with the last element, and then decreasing the size of
 the array by two for next call
Procedures
 1. Inserting all elements of the array.
 2. Defining and initializing two variables, (firstindex = 0) and (lastindex = size-1).
 3. Calling the "Enhanced Bubble Sort" function with passing the array, its size, firstindex, and
lastindex as parameters of the function.
 4. In the "Enhanced Bubble Sort" function, the operation now is to find the maximum and the
minimum elementsand saving the index value of the max of the array in the variable maxcounter, and
the index value of the minin the variable mincounter.
 5. Put the max in the lastindex and min in the firstindex of the array without losing the last values of
the first index and the last index of the original array.
 6. Decreasing the value of lastindex by one and increasing the value of firstindex by one.
Operationally, the size of the array after the first call became (size-2), and after the second call it
actually became (size-4), and soon.
 7. Calling the "Enhanced Bubble Sort " array recursively while the size of the array is greater than one
(size>1). Then returning the sorted array.
Pseudocode
Case Study
 This section presents a real-world case study to sort students of Al al-Bayt
University in Jordan by the university number (students IDs) in ascending
order.
 In this case study, BS, SS, shell sort, enhanced shell sort, ESS, and EBS algorithms
are applied with 12500 as total number of students.
Sorting Techniques
Conclusions
 In this paper, two new sorting algorithms are presented.
 ESS has complexity, but it is faster than SS, especially if the input array is stored in
secondary memory, since it performs less number of swap operations.
 EBS is definitely faster than BSS can be specially implemented to be stable. Furthermore,
the proposed algorithms are compared with some recent sorting algorithms; shell sort
and enhanced shell sort. These algorithms are applied on a real-world case study of
sorting a database of (12500) records and the results showed that the EBS also increases the
efficiency of both shell sort and enhanced shell sort algorithms.
enhancement of sorting algorithm
Ad

More Related Content

What's hot (20)

02 Arrays And Memory Mapping
02 Arrays And Memory Mapping02 Arrays And Memory Mapping
02 Arrays And Memory Mapping
Qundeel
 
Lesson 4
Lesson 4Lesson 4
Lesson 4
Vinnu Vinay
 
Array operations
Array operationsArray operations
Array operations
ZAFAR444
 
Heaps & priority queues
Heaps & priority queuesHeaps & priority queues
Heaps & priority queues
Pedro Hugo Valencia Morales
 
arrays
arraysarrays
arrays
Enakshi Chanda
 
Data preprocessing for Machine Learning with R and Python
Data preprocessing for Machine Learning with R and PythonData preprocessing for Machine Learning with R and Python
Data preprocessing for Machine Learning with R and Python
Akhilesh Joshi
 
Java equals hashCode Contract
Java equals hashCode ContractJava equals hashCode Contract
Java equals hashCode Contract
Sujit Kumar
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
Zidny Nafan
 
Arrays
ArraysArrays
Arrays
Faisal Aziz
 
Set data structure
Set data structure Set data structure
Set data structure
Tech_MX
 
Unit ii data structure-converted
Unit  ii data structure-convertedUnit  ii data structure-converted
Unit ii data structure-converted
Shri Shankaracharya College, Bhilai,Junwani
 
stack & queue
stack & queuestack & queue
stack & queue
manju rani
 
HCR's Series (Expansion of factorial of any natural number)
HCR's Series (Expansion of factorial of any natural number)HCR's Series (Expansion of factorial of any natural number)
HCR's Series (Expansion of factorial of any natural number)
Harish Chandra Rajpoot
 
Arrays
ArraysArrays
Arrays
SARITHA REDDY
 
Array
ArrayArray
Array
PRN USM
 
Control statements
Control statementsControl statements
Control statements
Pramod Rathore
 
DPLYR package in R
DPLYR package in RDPLYR package in R
DPLYR package in R
Bimba Pawar
 
Linear sorting
Linear sortingLinear sorting
Linear sorting
Krishna Chaytaniah
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Julie Iskander
 
Manipulating data with dates
Manipulating data with datesManipulating data with dates
Manipulating data with dates
Rupak Roy
 

Similar to enhancement of sorting algorithm (20)

Data structures arrays
Data structures   arraysData structures   arrays
Data structures arrays
maamir farooq
 
data structures and algorithms Unit 3
data structures and algorithms Unit 3data structures and algorithms Unit 3
data structures and algorithms Unit 3
infanciaj
 
Sorting
SortingSorting
Sorting
BHARATH KUMAR
 
Sorting
SortingSorting
Sorting
Kariman Karm Gabaa
 
Advanced s and s algorithm.ppt
Advanced s and s algorithm.pptAdvanced s and s algorithm.ppt
Advanced s and s algorithm.ppt
LegesseSamuel
 
Sorting.ppt read only
Sorting.ppt read onlySorting.ppt read only
Sorting.ppt read only
VARSHAKUMARI49
 
Sorting Seminar Presentation by Ashin Guha Majumder
Sorting Seminar Presentation by Ashin Guha MajumderSorting Seminar Presentation by Ashin Guha Majumder
Sorting Seminar Presentation by Ashin Guha Majumder
Ashin Guha Majumder
 
CPP Programming Homework Help
CPP Programming Homework HelpCPP Programming Homework Help
CPP Programming Homework Help
C++ Homework Help
 
Heap, quick and merge sort
Heap, quick and merge sortHeap, quick and merge sort
Heap, quick and merge sort
Dr. Mohammad Amir Khusru Akhtar (Ph.D)
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
CHANDAN KUMAR
 
Sorting
SortingSorting
Sorting
A. S. M. Shafi
 
Sorting and Searching Techniques
Sorting and Searching TechniquesSorting and Searching Techniques
Sorting and Searching Techniques
Prof Ansari
 
Arrays
ArraysArrays
Arrays
shillpi29
 
Chapter3.pptx
Chapter3.pptxChapter3.pptx
Chapter3.pptx
ASMAALWADEE2
 
Selection Sort & Insertion Sorts Algorithms
Selection Sort & Insertion Sorts AlgorithmsSelection Sort & Insertion Sorts Algorithms
Selection Sort & Insertion Sorts Algorithms
Ahmad177077
 
Selection Sort & Insertion Sorts Algorithms
Selection Sort & Insertion Sorts AlgorithmsSelection Sort & Insertion Sorts Algorithms
Selection Sort & Insertion Sorts Algorithms
Ahmad177077
 
advanced searching and sorting.pdf
advanced searching and sorting.pdfadvanced searching and sorting.pdf
advanced searching and sorting.pdf
haramaya university
 
Shell sorting
Shell sortingShell sorting
Shell sorting
TUC
 
Algo PPT.pdf
Algo PPT.pdfAlgo PPT.pdf
Algo PPT.pdf
sheraz7288
 
Array Presentation
Array PresentationArray Presentation
Array Presentation
Deep Prajapati Microplacer
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arrays
maamir farooq
 
data structures and algorithms Unit 3
data structures and algorithms Unit 3data structures and algorithms Unit 3
data structures and algorithms Unit 3
infanciaj
 
Advanced s and s algorithm.ppt
Advanced s and s algorithm.pptAdvanced s and s algorithm.ppt
Advanced s and s algorithm.ppt
LegesseSamuel
 
Sorting Seminar Presentation by Ashin Guha Majumder
Sorting Seminar Presentation by Ashin Guha MajumderSorting Seminar Presentation by Ashin Guha Majumder
Sorting Seminar Presentation by Ashin Guha Majumder
Ashin Guha Majumder
 
CPP Programming Homework Help
CPP Programming Homework HelpCPP Programming Homework Help
CPP Programming Homework Help
C++ Homework Help
 
Sorting and Searching Techniques
Sorting and Searching TechniquesSorting and Searching Techniques
Sorting and Searching Techniques
Prof Ansari
 
Selection Sort & Insertion Sorts Algorithms
Selection Sort & Insertion Sorts AlgorithmsSelection Sort & Insertion Sorts Algorithms
Selection Sort & Insertion Sorts Algorithms
Ahmad177077
 
Selection Sort & Insertion Sorts Algorithms
Selection Sort & Insertion Sorts AlgorithmsSelection Sort & Insertion Sorts Algorithms
Selection Sort & Insertion Sorts Algorithms
Ahmad177077
 
advanced searching and sorting.pdf
advanced searching and sorting.pdfadvanced searching and sorting.pdf
advanced searching and sorting.pdf
haramaya university
 
Shell sorting
Shell sortingShell sorting
Shell sorting
TUC
 
Ad

Recently uploaded (20)

Mobile Application Developer Dubai | Custom App Solutions by Ajath
Mobile Application Developer Dubai | Custom App Solutions by AjathMobile Application Developer Dubai | Custom App Solutions by Ajath
Mobile Application Developer Dubai | Custom App Solutions by Ajath
Ajath Infotech Technologies LLC
 
Top 12 Most Useful AngularJS Development Tools to Use in 2025
Top 12 Most Useful AngularJS Development Tools to Use in 2025Top 12 Most Useful AngularJS Development Tools to Use in 2025
Top 12 Most Useful AngularJS Development Tools to Use in 2025
GrapesTech Solutions
 
Unit Two - Java Architecture and OOPS
Unit Two  -   Java Architecture and OOPSUnit Two  -   Java Architecture and OOPS
Unit Two - Java Architecture and OOPS
Nabin Dhakal
 
[gbgcpp] Let's get comfortable with concepts
[gbgcpp] Let's get comfortable with concepts[gbgcpp] Let's get comfortable with concepts
[gbgcpp] Let's get comfortable with concepts
Dimitrios Platis
 
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business StageA Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
SynapseIndia
 
The Elixir Developer - All Things Open
The Elixir Developer - All Things OpenThe Elixir Developer - All Things Open
The Elixir Developer - All Things Open
Carlo Gilmar Padilla Santana
 
Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509
Fermin Galan
 
Medical Device Cybersecurity Threat & Risk Scoring
Medical Device Cybersecurity Threat & Risk ScoringMedical Device Cybersecurity Threat & Risk Scoring
Medical Device Cybersecurity Threat & Risk Scoring
ICS
 
How to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryErrorHow to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryError
Tier1 app
 
wAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptxwAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptx
SimonedeGijt
 
Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??
Web Designer
 
Artificial hand using embedded system.pptx
Artificial hand using embedded system.pptxArtificial hand using embedded system.pptx
Artificial hand using embedded system.pptx
bhoomigowda12345
 
Wilcom Embroidery Studio Crack 2025 For Windows
Wilcom Embroidery Studio Crack 2025 For WindowsWilcom Embroidery Studio Crack 2025 For Windows
Wilcom Embroidery Studio Crack 2025 For Windows
Google
 
Beyond the code. Complexity - 2025.05 - SwiftCraft
Beyond the code. Complexity - 2025.05 - SwiftCraftBeyond the code. Complexity - 2025.05 - SwiftCraft
Beyond the code. Complexity - 2025.05 - SwiftCraft
Dmitrii Ivanov
 
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World ExamplesMastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
jamescantor38
 
NYC ACE 08-May-2025-Combined Presentation.pdf
NYC ACE 08-May-2025-Combined Presentation.pdfNYC ACE 08-May-2025-Combined Presentation.pdf
NYC ACE 08-May-2025-Combined Presentation.pdf
AUGNYC
 
Exchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv SoftwareExchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv Software
Shoviv Software
 
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-RuntimeReinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Natan Silnitsky
 
Adobe InDesign Crack FREE Download 2025 link
Adobe InDesign Crack FREE Download 2025 linkAdobe InDesign Crack FREE Download 2025 link
Adobe InDesign Crack FREE Download 2025 link
mahmadzubair09
 
Sequence Diagrams With Pictures (1).pptx
Sequence Diagrams With Pictures (1).pptxSequence Diagrams With Pictures (1).pptx
Sequence Diagrams With Pictures (1).pptx
aashrithakondapalli8
 
Mobile Application Developer Dubai | Custom App Solutions by Ajath
Mobile Application Developer Dubai | Custom App Solutions by AjathMobile Application Developer Dubai | Custom App Solutions by Ajath
Mobile Application Developer Dubai | Custom App Solutions by Ajath
Ajath Infotech Technologies LLC
 
Top 12 Most Useful AngularJS Development Tools to Use in 2025
Top 12 Most Useful AngularJS Development Tools to Use in 2025Top 12 Most Useful AngularJS Development Tools to Use in 2025
Top 12 Most Useful AngularJS Development Tools to Use in 2025
GrapesTech Solutions
 
Unit Two - Java Architecture and OOPS
Unit Two  -   Java Architecture and OOPSUnit Two  -   Java Architecture and OOPS
Unit Two - Java Architecture and OOPS
Nabin Dhakal
 
[gbgcpp] Let's get comfortable with concepts
[gbgcpp] Let's get comfortable with concepts[gbgcpp] Let's get comfortable with concepts
[gbgcpp] Let's get comfortable with concepts
Dimitrios Platis
 
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business StageA Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
SynapseIndia
 
Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509
Fermin Galan
 
Medical Device Cybersecurity Threat & Risk Scoring
Medical Device Cybersecurity Threat & Risk ScoringMedical Device Cybersecurity Threat & Risk Scoring
Medical Device Cybersecurity Threat & Risk Scoring
ICS
 
How to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryErrorHow to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryError
Tier1 app
 
wAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptxwAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptx
SimonedeGijt
 
Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??
Web Designer
 
Artificial hand using embedded system.pptx
Artificial hand using embedded system.pptxArtificial hand using embedded system.pptx
Artificial hand using embedded system.pptx
bhoomigowda12345
 
Wilcom Embroidery Studio Crack 2025 For Windows
Wilcom Embroidery Studio Crack 2025 For WindowsWilcom Embroidery Studio Crack 2025 For Windows
Wilcom Embroidery Studio Crack 2025 For Windows
Google
 
Beyond the code. Complexity - 2025.05 - SwiftCraft
Beyond the code. Complexity - 2025.05 - SwiftCraftBeyond the code. Complexity - 2025.05 - SwiftCraft
Beyond the code. Complexity - 2025.05 - SwiftCraft
Dmitrii Ivanov
 
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World ExamplesMastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
jamescantor38
 
NYC ACE 08-May-2025-Combined Presentation.pdf
NYC ACE 08-May-2025-Combined Presentation.pdfNYC ACE 08-May-2025-Combined Presentation.pdf
NYC ACE 08-May-2025-Combined Presentation.pdf
AUGNYC
 
Exchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv SoftwareExchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv Software
Shoviv Software
 
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-RuntimeReinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Natan Silnitsky
 
Adobe InDesign Crack FREE Download 2025 link
Adobe InDesign Crack FREE Download 2025 linkAdobe InDesign Crack FREE Download 2025 link
Adobe InDesign Crack FREE Download 2025 link
mahmadzubair09
 
Sequence Diagrams With Pictures (1).pptx
Sequence Diagrams With Pictures (1).pptxSequence Diagrams With Pictures (1).pptx
Sequence Diagrams With Pictures (1).pptx
aashrithakondapalli8
 
Ad

enhancement of sorting algorithm

  • 1. An Enhancement of Major Sorting Algorithms Group 7 Roll No Akber Ali 1406 Assad Ali 1407 Qasim Ali 1425 Touseef Khadim 1427
  • 2. Discuss  Enhanced selection sort  Enhanced bubble sort  Selection sort  Bubble sort  Number of swaps  Time complexity.
  • 3. Enhanced Selection Sort  Inserting an array of elements and sorting these elements in the same array (in-place) by finding the maximum element and exchanging it with the last element, and then decreasing the size of the array by one for next call.  In fact, the Enhanced Selection Sort (ESS) algorithm is an enhancement to the SS algorithm in decreasing number of swap operations, making the algorithm to be data dependent, and in making it stable.
  • 4. Procedures  Inserting all elements of the array.  Calling the “Enhanced Selection Sort” function with passing the array and its size as parameters.  Finding the maximum element in the array.  And swapping it with the last index of the same array.  Decreasing the size of the array by one.  Calling the “Enhanced Selection Sort” function recursively.  The size of the array is decremented by one after each call of the “Enhanced Selection Sort” function.  Operationally, the (size) after the first call became (size-1), and after the second call became (size-2), and so on
  • 5. Pseudo code  1- If size > 1 then  2- var index, temp, max  3- index := size-1  4- max := array(index)  5- for a:= 0 to size-2 do  6- if array(a) ≥ max then  7- max := array(a)  8- index := a  9- end if  10- end for  11- if index ≠ size-1 then  12- temp := array(size-1)  13- array(size-1) := max  14- array(index) := temp  15- end if  16- size := size-1  17- return Enhanced Selection Sort (array , size)  18- else  19- return array  20- end if
  • 6. Analysis  a) In the best-case scenario; if the input array is already sorted (ascending order), then there is no need to make swapping, since each element is in the correct place.  b) In the average-case scenario; if the input array is sorted in reverse (descending order), then the total number of swapping operations is: floor of (n/2). Since swapping the maximum value with the last element means that the maximum and the minimum values are in the correct places. For example, if we have a descending sorted array as follows: Then the algorithm will swap the first element (max) with the last element, as follows:  Since the last element before swapping was the minimum value, it is after swapping got in the correct place and cannot be the maximum value in any of the next comparisons. In the next comparison, the second element now is the maximum value and it will be swapped with the fourth (size-1)the element.  The array now is sorted and the algorithm required two swap operations to sort the input array of five elements. That means, the swapping operations that are needed to sort a descending sorted array is floor of (n/2).  c) In the worst case; if the input array is unsorted neither ascending nor descending, then the required swapping operations are approximately operations.
  • 7. Enhanced Bubble Sort  The proposed algorithm is considered as an enhancement to the original Bubble sort algorithm and it works as follows:  Inserting an array of elements and sorting these elements in the same array (in place) by finding the minimum and the maximum elements and exchanging  The minimum with the first element and the maximum  with the last element, and then decreasing the size of  the array by two for next call
  • 8. Procedures  1. Inserting all elements of the array.  2. Defining and initializing two variables, (firstindex = 0) and (lastindex = size-1).  3. Calling the "Enhanced Bubble Sort" function with passing the array, its size, firstindex, and lastindex as parameters of the function.  4. In the "Enhanced Bubble Sort" function, the operation now is to find the maximum and the minimum elementsand saving the index value of the max of the array in the variable maxcounter, and the index value of the minin the variable mincounter.  5. Put the max in the lastindex and min in the firstindex of the array without losing the last values of the first index and the last index of the original array.  6. Decreasing the value of lastindex by one and increasing the value of firstindex by one. Operationally, the size of the array after the first call became (size-2), and after the second call it actually became (size-4), and soon.  7. Calling the "Enhanced Bubble Sort " array recursively while the size of the array is greater than one (size>1). Then returning the sorted array.
  • 10. Case Study  This section presents a real-world case study to sort students of Al al-Bayt University in Jordan by the university number (students IDs) in ascending order.  In this case study, BS, SS, shell sort, enhanced shell sort, ESS, and EBS algorithms are applied with 12500 as total number of students.
  • 12. Conclusions  In this paper, two new sorting algorithms are presented.  ESS has complexity, but it is faster than SS, especially if the input array is stored in secondary memory, since it performs less number of swap operations.  EBS is definitely faster than BSS can be specially implemented to be stable. Furthermore, the proposed algorithms are compared with some recent sorting algorithms; shell sort and enhanced shell sort. These algorithms are applied on a real-world case study of sorting a database of (12500) records and the results showed that the EBS also increases the efficiency of both shell sort and enhanced shell sort algorithms.
  翻译: