SlideShare a Scribd company logo
1 of 5
Download to read offline
© 2019 JETIR June 2019, Volume 6, Issue 6 www.jetir.org (ISSN-2349-5162)
JETIR1906780 Journal of Emerging Technologies and Innovative Research (JETIR) www.jetir.org 358
SQUARE ROOT SORTING ALGORITHM
1
Mir Omranudin Abhar, 2
Nisha Gatuam
1
M.Tech Student, 2
Assistant Professor
1,2
Department of Computer Science & Engineering
1,2
AP Goyal Shimla University, Shimla, India
Abstract: In this paper, we are going to introduce the Square root sorting algorithm. We study the best case and worst case of Square
root sorting algorithm, and we compare this algorithm with some of the algorithms that are already existed.
A Sorting Algorithm is used to rearrange a given array elements according to a comparison operator on the elements. So far there
are many algorithms that have been used for sorting like: Bubble sort, insertion sort, selection sort, quick sort, merge sort, heap sort
etc. Each of these algorithms are used according to the list of elements of specific usage and they have specific space complexity
and time complexity as well. The Square root sorting algorithm has the least time complexity comparing to some of the existing
algorithms, especially in case of the best case, and in the worst case it also has less time complexity than some of the existing
algorithms, which we will discuss it in coming pages of this paper.
Keyword- Algorithm, Time Complexity, Space Complexity, Sorting.
I. INTRODUCTION
Data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently [5]. Sorting is
one of the most important and valuable parts in the data structure, Sorting is nothing but arrangement of a set of data in some order
or a process that rearranges the records in a file into a sequence that is sorted on some key.
Different methods are used to sort the data in ascending or descending orders. The different sorting methods can be divided into
two categories:
 Internal sorting(sorting of data items in the main memory)
 External sorting (when the data to be sorted is so large that some of the data is present in the memory and some is kept in
auxiliary memory)
Arrays (sets of items of the same type) are stored in the fast, high-speed random access internal storage on computers, whereas files
are stored on the slower but more spacious External store [2].
The Square root sorting algorithm is the type of sorting of internal algorithms that deals with the sorting of data items in the main
memory, which, in particular, has the best result compared to previous algorithms. We combine this algorithm with one of the best-
performing algorithms in the best case and worst case scenarios, we use the merge sort or quick sort algorithm, because these two
sorting algorithms are among the best of available algorithms. We will discuss about it later.
Figure.1. Sorting.
II. PROBLEM FORMULATION
The goal of designing the SRS (Square Root Sorting) algorithm is to reduce the time complexity of the memory.
We use one of the best sorting algorithms in combining this scheme of sorting from data items, which if we find better algorithms
in the future we can give it a place. But the current algorithm doesn't have any problem by using merge sort.
This is how our algorithm works:
First, we divide the list of data using square root operation. We will have equal numbers of elements in each part except last
part, it might contain less elements than other parts.
The second step is to sort each part separately using one of the available algorithms, which has the least time complexity.
The third step is to start comparing data items and swapping.
The comparison method is such that we compare the first element of the first part with the first element of the other sections,
If the first element of the other part is larger, we will not perform the comparison with other elements of that section. It is because
if the first element of one of the segments is larger, it states that other elements of this section are also larger than the first element
of the first part.
We can find the smallest element in the first swapping operation and put it at first index of the array.
Similarly, we start the comparison with the second element of the first part. We still compare it with only the first elements of the
other segments. If one of the first elements of the other part is smaller than the first element of the first part, we will perform the
swap operation. This means that the second small element is in the second index of array.
Now, if the swap element of that section is larger than the next element, we will perform the sorting operation with the same
algorithm we have selected twice over.
If others are in the sorted order, there is no need to be sorted again. Similarly, it is time to compare the third element of the first
part. We do the same thing twice before the end.
© 2019 JETIR June 2019, Volume 6, Issue 6 www.jetir.org (ISSN-2349-5162)
JETIR1906780 Journal of Emerging Technologies and Innovative Research (JETIR) www.jetir.org 359
III. ALGORITHMS
Step 1. 𝑛 ← 𝑙𝑒𝑛𝑔𝑡ℎ of List 𝐴, 𝑟 ← √ 𝑛 ,𝑠 = 0 .
Step 2. Divide the list 𝐴 in 𝑟 part and every part have 𝑟 item in that list.
Step 3. 𝑓𝑜𝑟(𝑝 = 1 𝑡𝑜 𝑟, 𝑝 + +) part of list 𝐴 individual sort, with the Merge sort or other Algorithms.
𝑚𝑒𝑟𝑔𝑒(𝑝𝑎𝑟𝑡. 𝑝)
Step 4. The first item will compare with the first item of seconds part.
𝑓𝑜𝑟(𝑝 = 1 𝑡𝑜 𝑟, 𝑝 + +){
𝑓𝑜𝑟(𝑖 = 1 𝑡𝑜 𝑟, 𝑖 + +){
𝑖𝑓(𝑝𝑎𝑟𝑡. (𝑝)[𝑖] ≤ 𝑝𝑎𝑟𝑡. (𝑝 + 1)[𝑠]){
𝑠 + +
}𝑒𝑙𝑠𝑒{
𝐴 ← 𝑝𝑎𝑟𝑡. (𝑖)[1]
𝐵 ← 𝑝𝑎𝑟𝑡. (𝑖 + 1)[𝑠]
𝑝𝑎𝑟𝑡. (𝑖 + 1)[𝑠] ← 𝐴
𝑝𝑎𝑟𝑡. (𝑝)[𝑖] ← 𝐵
𝑚𝑒𝑟𝑔𝑒(𝑝𝑎𝑟𝑡. (𝑖 + 1))
}
}
𝑠 = 0
}
Step 5. Return A
Complexity Analysis: The complexity of a sorting algorithm measures the running time as a function of the number of 𝑛 items to
be sorted. Each sorting algorithm 𝑆 will be made up of the following operations, where 𝐴1, 𝐴2 . . . 𝐴 𝑛 contain the items to be sorted
and 𝐵 is an auxiliary location.
1. Comparisons which test whether 𝐴𝑖 < 𝐴𝑖 or test whether𝐴𝑖 < 𝐵.
2. Interchanges which switch the contents of 𝐴𝑖 and 𝐴𝑗 𝑜𝑟 𝐴𝑖 𝑎𝑛𝑑 𝐵.
3. Assignments which set 𝐵 = 𝐴𝑖 and then set 𝐴𝑗 = 𝐵 or 𝐴𝑗 = 𝐴𝑖 .
Generally the complexity function measures only the number of comparisons, since the number of other operations is at most a
constant factor of the number of other operations is at most a constant factor of the number of comparisons. Suppose space is fixed
for one algorithm then only run time will be considered for obtaining the complexity of algorithm [5,4].
Complexity analysis of the proposed SR Sorting Algorithm for best case and worst case is discussed here with the help of examples.
A. Best Case:
In this case the array is already sorted and the terminating conditions is obtained after traversing the array twice. In this case, the
complexity of the SR algorithm is𝑂(𝑛 (log √ 𝑛)).
Figure. 2. Best Case SRS Algorithm.
© 2019 JETIR June 2019, Volume 6, Issue 6 www.jetir.org (ISSN-2349-5162)
JETIR1906780 Journal of Emerging Technologies and Innovative Research (JETIR) www.jetir.org 360
B. Average Case:
In this case the array data items used the random number, In this case, the complexity of the SR algorithm is 𝑂((𝑛 log √ 𝑛) + 𝑐𝑛).
Figure. 3. Average Case SRS Algorithm.
C. Worst Case:
Reverse sorted array which involves every element to be moved to (𝑛 + 1)𝑡ℎ
position from its initial 𝑖 𝑡ℎ
position. In this case,
the complexity of the SR algorithm is 𝑂(𝑛(log √ 𝑛) + 𝑐𝑛).
Figure. 4. Worst Case SRS Algorithm.
IV. COMPARE SRS ALGORITHM WITH OTHER SORTING ALGORITHM
Which sorting algorithm is the fastest? This question doesn't have an easy or unambiguous answer, however. The speed of
sorting can depend quite heavily on the environment where the sorting is done, the type of items that are sorted and the distribution
of these items.
For example, sorting a database which is so big that cannot fit into memory all at once is quite different from sorting an array of
100 integers. Not only will the implementation of the algorithm be quite different, naturally, but it may even be that the same
algorithm which is fast in one case is slow in the other. Also sorting an array may be different from sorting a linked list, for example
[1].
In order to better understand the advantages and disadvantages of an algorithm, there is a need for time that the algorithm should
be adapted in different criteria’s so that the results obtained can be examined in order to understand the advantages and
disadvantages of the algorithm.
When we discuss the complexity of the SR algorithm, we have achieved the results after it was implemented in Java programming
language which indicates that the algorithm performs a comparative and substitute comparison with previous algorithms.
© 2019 JETIR June 2019, Volume 6, Issue 6 www.jetir.org (ISSN-2349-5162)
JETIR1906780 Journal of Emerging Technologies and Innovative Research (JETIR) www.jetir.org 361
This algorithm can still be called a technique that replaces any sorting algorithm that exists up to now or in the future in order to
reduce the time complexity of the algorithm and when we compare merge sort with this algorithm, the results obtained from 100 to
102400 data items are presented in the following way:
Figure. 5. Compare Merge Sort with SR-Sort at the best case.
Figure. 6. Compare Merge Sort with SR-Sort at the average case
.
Figure. 7. Compare Merge Sort with SR-Sort at the best case
The following table illustrates the complexity of some sorting algorithms with SR sorting algorithms.
ALGORITHMS BEST CASE AVERAGE CASE WORST CASE
SR Sort 𝑛 log(√ 𝑛) 𝑛 log(√ 𝑛) + 𝑐𝑛 𝑛 log(√ 𝑛) + 𝑐𝑛
Merge Sort 𝑛 log(𝑛) 𝑛 log(𝑛) 𝑛 log(𝑛)
Bubble Sort 𝑛 𝑛2
𝑛2
Insertion Sort 𝑛 𝑛2
𝑛2
© 2019 JETIR June 2019, Volume 6, Issue 6 www.jetir.org (ISSN-2349-5162)
JETIR1906780 Journal of Emerging Technologies and Innovative Research (JETIR) www.jetir.org 362
Selection Sort 𝑛2
𝑛2
𝑛2
V. CONCLUSION
In this research paper, we discussed the SR algorithm. The performance of the algorithm and comparison with other existing
algorithms in terms of time and space complexity. This algorithm is one of the best algorithms with less time and space complexity,
especially in best case and better performance in worst case than some other existing algorithms.
In case of time complexity, the SR algorithm has better performance than Insertion Sort, Bubble Sort and Selection Sort. And in
case of best case, it performs better than merge sort although merge sort performs better in worst case.
VI. ACKNOWLEDGEMENTS
First of all, I would like to thank the most merciful and the most gracious Allah who teaches and shows us the way of happiness
of this and next word by the agency of his messenger the owner of honor Mohammad (peace be open him) and give command for
learning the knowledge. I am grateful from the all lectures especially my supervisor Asst.Prof.Ms NISHA GAUTAM for his
valuable contributions, patience and guidance through this study. I am grateful to my parents for their hidden help in terms of
prayers and faith in me, which actually empowered me to fulfill this task. And last, I am grateful to all my entourage, classmates
and companions who helped me on the journey of university career and made it easier. I would also like to thank my entourage,
classmates and companions especially from my partner Eng. Ehsan Bayat who helped me on the journey of university career and
made it easier.
And last but not least, I am grateful to my parents for their hidden help in terms of prayers and faith in me, which actually
empowered me to fulfill this task.
REFERENCES
[1] Comparison of several sorting algorithms. http: //warp.povusers.org/SortComparison/ .Accessed: 2018-11-13.
[2] Tata McGraw-Hill Education. Data Structures and Algorithms Using C. 2010.
[3] Harish Chugh Gaurav Kumar. Empirical Study Of Complexity Graphs for Sorting Algorithms". In :( 2013).
[4] seymour Lipschutz. “Data Structures With C". In: 2013 .
[5] R.Mariselvi G.Santhana Devi C.Rajalakshmi C.Durai V.P.Kulalviamozhi M.Muthulakshmi. Performance Analysis of Sorting
Algorithm , IEEE Journals . 2015.
[6] Indradeep hayran and Pritee Khanna. Couple Sort, PDGC , 2016.
[7] Hoda Osama ,Yasser Omar and Amr Badr. Mapping Sorting Alogirhtm , IEEE, July 2016.
[8] Chen Hongyan, Wan Junwei, Lu Xianli , Research and implementation of database high performance sorting algorithm with
big data, IEEE,2017
[9] Wei Wang, Big Data, Big Challenges , IEEE , 2014

More Related Content

What's hot

Toll application - .NET and Android - SRS
Toll application - .NET and Android - SRSToll application - .NET and Android - SRS
Toll application - .NET and Android - SRSArun prasath
 
Railway booking & management system
Railway booking & management systemRailway booking & management system
Railway booking & management systemNikhil Raj
 
4.3 techniques for turing machines construction
4.3 techniques for turing machines construction4.3 techniques for turing machines construction
4.3 techniques for turing machines constructionSampath Kumar S
 
17 cpu scheduling and scheduling criteria
17 cpu scheduling and scheduling criteria 17 cpu scheduling and scheduling criteria
17 cpu scheduling and scheduling criteria myrajendra
 
Operating Systems 1 (7/12) - Threads
Operating Systems 1 (7/12) - ThreadsOperating Systems 1 (7/12) - Threads
Operating Systems 1 (7/12) - ThreadsPeter Tröger
 
Clock driven scheduling
Clock driven schedulingClock driven scheduling
Clock driven schedulingKamal Acharya
 
Arm corrected ppt
Arm corrected pptArm corrected ppt
Arm corrected pptanish jagan
 
Design challenges in embedded systems
Design challenges in embedded systemsDesign challenges in embedded systems
Design challenges in embedded systemsmahalakshmimalini
 
CSI-503 - 13. Scheduler and Dispatcher
CSI-503 - 13. Scheduler and Dispatcher CSI-503 - 13. Scheduler and Dispatcher
CSI-503 - 13. Scheduler and Dispatcher ghayour abbas
 
Parsing in Compiler Design
Parsing in Compiler DesignParsing in Compiler Design
Parsing in Compiler DesignAkhil Kaushik
 
OS Functions and Services
OS Functions and ServicesOS Functions and Services
OS Functions and Servicessgpraju
 
C++ Memory Management
C++ Memory ManagementC++ Memory Management
C++ Memory ManagementRahul Jamwal
 
Http tunneling exploit daniel adenew web
Http tunneling exploit daniel adenew webHttp tunneling exploit daniel adenew web
Http tunneling exploit daniel adenew webDaniel Adenew
 
RECURSIVE DESCENT PARSING
RECURSIVE DESCENT PARSINGRECURSIVE DESCENT PARSING
RECURSIVE DESCENT PARSINGJothi Lakshmi
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentationusmankiyani1
 

What's hot (20)

Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
Toll application - .NET and Android - SRS
Toll application - .NET and Android - SRSToll application - .NET and Android - SRS
Toll application - .NET and Android - SRS
 
5 Process Scheduling
5 Process Scheduling5 Process Scheduling
5 Process Scheduling
 
Railway booking & management system
Railway booking & management systemRailway booking & management system
Railway booking & management system
 
CLE Unit - 5 - Cyber Ethics
CLE Unit - 5 - Cyber EthicsCLE Unit - 5 - Cyber Ethics
CLE Unit - 5 - Cyber Ethics
 
4.3 techniques for turing machines construction
4.3 techniques for turing machines construction4.3 techniques for turing machines construction
4.3 techniques for turing machines construction
 
17 cpu scheduling and scheduling criteria
17 cpu scheduling and scheduling criteria 17 cpu scheduling and scheduling criteria
17 cpu scheduling and scheduling criteria
 
Operating Systems 1 (7/12) - Threads
Operating Systems 1 (7/12) - ThreadsOperating Systems 1 (7/12) - Threads
Operating Systems 1 (7/12) - Threads
 
Assembler (2)
Assembler (2)Assembler (2)
Assembler (2)
 
Clock driven scheduling
Clock driven schedulingClock driven scheduling
Clock driven scheduling
 
Arm corrected ppt
Arm corrected pptArm corrected ppt
Arm corrected ppt
 
Design challenges in embedded systems
Design challenges in embedded systemsDesign challenges in embedded systems
Design challenges in embedded systems
 
ARM Architecture
ARM ArchitectureARM Architecture
ARM Architecture
 
CSI-503 - 13. Scheduler and Dispatcher
CSI-503 - 13. Scheduler and Dispatcher CSI-503 - 13. Scheduler and Dispatcher
CSI-503 - 13. Scheduler and Dispatcher
 
Parsing in Compiler Design
Parsing in Compiler DesignParsing in Compiler Design
Parsing in Compiler Design
 
OS Functions and Services
OS Functions and ServicesOS Functions and Services
OS Functions and Services
 
C++ Memory Management
C++ Memory ManagementC++ Memory Management
C++ Memory Management
 
Http tunneling exploit daniel adenew web
Http tunneling exploit daniel adenew webHttp tunneling exploit daniel adenew web
Http tunneling exploit daniel adenew web
 
RECURSIVE DESCENT PARSING
RECURSIVE DESCENT PARSINGRECURSIVE DESCENT PARSING
RECURSIVE DESCENT PARSING
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentation
 

Similar to SQUARE ROOT SORTING ALGORITHM

Ijcse13 05-01-048
Ijcse13 05-01-048Ijcse13 05-01-048
Ijcse13 05-01-048vital vital
 
Ijcse13 05-01-048
Ijcse13 05-01-048Ijcse13 05-01-048
Ijcse13 05-01-048vital vital
 
How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...
How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...
How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...PhD Assistance
 
How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...
How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...
How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...PhD Assistance
 
Algorithms.pptx
Algorithms.pptxAlgorithms.pptx
Algorithms.pptxjohn6938
 
Study on Sorting Algorithm and Position Determining Sort
Study on Sorting Algorithm and Position Determining SortStudy on Sorting Algorithm and Position Determining Sort
Study on Sorting Algorithm and Position Determining SortIRJET Journal
 
The International Journal of Engineering and Science (The IJES)
The International Journal of Engineering and Science (The IJES)The International Journal of Engineering and Science (The IJES)
The International Journal of Engineering and Science (The IJES)theijes
 
Selection Sort with Improved Asymptotic Time Bounds
Selection Sort with Improved Asymptotic Time BoundsSelection Sort with Improved Asymptotic Time Bounds
Selection Sort with Improved Asymptotic Time Boundstheijes
 
IRJET- A Survey on Different Searching Algorithms
IRJET- A Survey on Different Searching AlgorithmsIRJET- A Survey on Different Searching Algorithms
IRJET- A Survey on Different Searching AlgorithmsIRJET Journal
 
Analysis and Comparative of Sorting Algorithms
Analysis and Comparative of Sorting AlgorithmsAnalysis and Comparative of Sorting Algorithms
Analysis and Comparative of Sorting Algorithmsijtsrd
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfAxmedcarb
 
Intruction to Algorithms.pptx
Intruction to Algorithms.pptxIntruction to Algorithms.pptx
Intruction to Algorithms.pptxSayantamalHalder
 
PROPOSAL OF A TWO WAY SORTING ALGORITHM AND PERFORMANCE COMPARISON WITH EXIST...
PROPOSAL OF A TWO WAY SORTING ALGORITHM AND PERFORMANCE COMPARISON WITH EXIST...PROPOSAL OF A TWO WAY SORTING ALGORITHM AND PERFORMANCE COMPARISON WITH EXIST...
PROPOSAL OF A TWO WAY SORTING ALGORITHM AND PERFORMANCE COMPARISON WITH EXIST...IJCSEA Journal
 

Similar to SQUARE ROOT SORTING ALGORITHM (20)

Ijcse13 05-01-048
Ijcse13 05-01-048Ijcse13 05-01-048
Ijcse13 05-01-048
 
Ijcse13 05-01-048
Ijcse13 05-01-048Ijcse13 05-01-048
Ijcse13 05-01-048
 
How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...
How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...
How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...
 
How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...
How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...
How to Implement Sorting Algorithms in C++ and Difficulty Faced in Coding it?...
 
Algorithms.pptx
Algorithms.pptxAlgorithms.pptx
Algorithms.pptx
 
Study on Sorting Algorithm and Position Determining Sort
Study on Sorting Algorithm and Position Determining SortStudy on Sorting Algorithm and Position Determining Sort
Study on Sorting Algorithm and Position Determining Sort
 
The International Journal of Engineering and Science (The IJES)
The International Journal of Engineering and Science (The IJES)The International Journal of Engineering and Science (The IJES)
The International Journal of Engineering and Science (The IJES)
 
Lu3520152020
Lu3520152020Lu3520152020
Lu3520152020
 
Selection Sort with Improved Asymptotic Time Bounds
Selection Sort with Improved Asymptotic Time BoundsSelection Sort with Improved Asymptotic Time Bounds
Selection Sort with Improved Asymptotic Time Bounds
 
Sorting algorithm
Sorting algorithmSorting algorithm
Sorting algorithm
 
IRJET- A Survey on Different Searching Algorithms
IRJET- A Survey on Different Searching AlgorithmsIRJET- A Survey on Different Searching Algorithms
IRJET- A Survey on Different Searching Algorithms
 
Dl36675677
Dl36675677Dl36675677
Dl36675677
 
Analysis and Comparative of Sorting Algorithms
Analysis and Comparative of Sorting AlgorithmsAnalysis and Comparative of Sorting Algorithms
Analysis and Comparative of Sorting Algorithms
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
my docoment
my docomentmy docoment
my docoment
 
Ds
DsDs
Ds
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdf
 
Intruction to Algorithms.pptx
Intruction to Algorithms.pptxIntruction to Algorithms.pptx
Intruction to Algorithms.pptx
 
PROPOSAL OF A TWO WAY SORTING ALGORITHM AND PERFORMANCE COMPARISON WITH EXIST...
PROPOSAL OF A TWO WAY SORTING ALGORITHM AND PERFORMANCE COMPARISON WITH EXIST...PROPOSAL OF A TWO WAY SORTING ALGORITHM AND PERFORMANCE COMPARISON WITH EXIST...
PROPOSAL OF A TWO WAY SORTING ALGORITHM AND PERFORMANCE COMPARISON WITH EXIST...
 
Sorting
SortingSorting
Sorting
 

More from MirOmranudinAbhar (20)

Dld 2
Dld 2Dld 2
Dld 2
 
Dld 3
Dld 3Dld 3
Dld 3
 
Dld 4
Dld 4Dld 4
Dld 4
 
Dld 1
Dld 1Dld 1
Dld 1
 
java-13
java-13java-13
java-13
 
java-12
java-12java-12
java-12
 
java-11
java-11java-11
java-11
 
java-10
java-10java-10
java-10
 
java-9
java-9java-9
java-9
 
java-8
java-8java-8
java-8
 
java-7
java-7java-7
java-7
 
java-6
java-6java-6
java-6
 
java-5
java-5java-5
java-5
 
java-4
java-4java-4
java-4
 
java-3
java-3java-3
java-3
 
java-2
java-2java-2
java-2
 
java-1
java-1java-1
java-1
 
Software-0
Software-0Software-0
Software-0
 
Net 1
Net 1Net 1
Net 1
 
Net 2
Net 2Net 2
Net 2
 

Recently uploaded

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Recently uploaded (20)

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

SQUARE ROOT SORTING ALGORITHM

  • 1. © 2019 JETIR June 2019, Volume 6, Issue 6 www.jetir.org (ISSN-2349-5162) JETIR1906780 Journal of Emerging Technologies and Innovative Research (JETIR) www.jetir.org 358 SQUARE ROOT SORTING ALGORITHM 1 Mir Omranudin Abhar, 2 Nisha Gatuam 1 M.Tech Student, 2 Assistant Professor 1,2 Department of Computer Science & Engineering 1,2 AP Goyal Shimla University, Shimla, India Abstract: In this paper, we are going to introduce the Square root sorting algorithm. We study the best case and worst case of Square root sorting algorithm, and we compare this algorithm with some of the algorithms that are already existed. A Sorting Algorithm is used to rearrange a given array elements according to a comparison operator on the elements. So far there are many algorithms that have been used for sorting like: Bubble sort, insertion sort, selection sort, quick sort, merge sort, heap sort etc. Each of these algorithms are used according to the list of elements of specific usage and they have specific space complexity and time complexity as well. The Square root sorting algorithm has the least time complexity comparing to some of the existing algorithms, especially in case of the best case, and in the worst case it also has less time complexity than some of the existing algorithms, which we will discuss it in coming pages of this paper. Keyword- Algorithm, Time Complexity, Space Complexity, Sorting. I. INTRODUCTION Data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently [5]. Sorting is one of the most important and valuable parts in the data structure, Sorting is nothing but arrangement of a set of data in some order or a process that rearranges the records in a file into a sequence that is sorted on some key. Different methods are used to sort the data in ascending or descending orders. The different sorting methods can be divided into two categories:  Internal sorting(sorting of data items in the main memory)  External sorting (when the data to be sorted is so large that some of the data is present in the memory and some is kept in auxiliary memory) Arrays (sets of items of the same type) are stored in the fast, high-speed random access internal storage on computers, whereas files are stored on the slower but more spacious External store [2]. The Square root sorting algorithm is the type of sorting of internal algorithms that deals with the sorting of data items in the main memory, which, in particular, has the best result compared to previous algorithms. We combine this algorithm with one of the best- performing algorithms in the best case and worst case scenarios, we use the merge sort or quick sort algorithm, because these two sorting algorithms are among the best of available algorithms. We will discuss about it later. Figure.1. Sorting. II. PROBLEM FORMULATION The goal of designing the SRS (Square Root Sorting) algorithm is to reduce the time complexity of the memory. We use one of the best sorting algorithms in combining this scheme of sorting from data items, which if we find better algorithms in the future we can give it a place. But the current algorithm doesn't have any problem by using merge sort. This is how our algorithm works: First, we divide the list of data using square root operation. We will have equal numbers of elements in each part except last part, it might contain less elements than other parts. The second step is to sort each part separately using one of the available algorithms, which has the least time complexity. The third step is to start comparing data items and swapping. The comparison method is such that we compare the first element of the first part with the first element of the other sections, If the first element of the other part is larger, we will not perform the comparison with other elements of that section. It is because if the first element of one of the segments is larger, it states that other elements of this section are also larger than the first element of the first part. We can find the smallest element in the first swapping operation and put it at first index of the array. Similarly, we start the comparison with the second element of the first part. We still compare it with only the first elements of the other segments. If one of the first elements of the other part is smaller than the first element of the first part, we will perform the swap operation. This means that the second small element is in the second index of array. Now, if the swap element of that section is larger than the next element, we will perform the sorting operation with the same algorithm we have selected twice over. If others are in the sorted order, there is no need to be sorted again. Similarly, it is time to compare the third element of the first part. We do the same thing twice before the end.
  • 2. © 2019 JETIR June 2019, Volume 6, Issue 6 www.jetir.org (ISSN-2349-5162) JETIR1906780 Journal of Emerging Technologies and Innovative Research (JETIR) www.jetir.org 359 III. ALGORITHMS Step 1. 𝑛 ← 𝑙𝑒𝑛𝑔𝑡ℎ of List 𝐴, 𝑟 ← √ 𝑛 ,𝑠 = 0 . Step 2. Divide the list 𝐴 in 𝑟 part and every part have 𝑟 item in that list. Step 3. 𝑓𝑜𝑟(𝑝 = 1 𝑡𝑜 𝑟, 𝑝 + +) part of list 𝐴 individual sort, with the Merge sort or other Algorithms. 𝑚𝑒𝑟𝑔𝑒(𝑝𝑎𝑟𝑡. 𝑝) Step 4. The first item will compare with the first item of seconds part. 𝑓𝑜𝑟(𝑝 = 1 𝑡𝑜 𝑟, 𝑝 + +){ 𝑓𝑜𝑟(𝑖 = 1 𝑡𝑜 𝑟, 𝑖 + +){ 𝑖𝑓(𝑝𝑎𝑟𝑡. (𝑝)[𝑖] ≤ 𝑝𝑎𝑟𝑡. (𝑝 + 1)[𝑠]){ 𝑠 + + }𝑒𝑙𝑠𝑒{ 𝐴 ← 𝑝𝑎𝑟𝑡. (𝑖)[1] 𝐵 ← 𝑝𝑎𝑟𝑡. (𝑖 + 1)[𝑠] 𝑝𝑎𝑟𝑡. (𝑖 + 1)[𝑠] ← 𝐴 𝑝𝑎𝑟𝑡. (𝑝)[𝑖] ← 𝐵 𝑚𝑒𝑟𝑔𝑒(𝑝𝑎𝑟𝑡. (𝑖 + 1)) } } 𝑠 = 0 } Step 5. Return A Complexity Analysis: The complexity of a sorting algorithm measures the running time as a function of the number of 𝑛 items to be sorted. Each sorting algorithm 𝑆 will be made up of the following operations, where 𝐴1, 𝐴2 . . . 𝐴 𝑛 contain the items to be sorted and 𝐵 is an auxiliary location. 1. Comparisons which test whether 𝐴𝑖 < 𝐴𝑖 or test whether𝐴𝑖 < 𝐵. 2. Interchanges which switch the contents of 𝐴𝑖 and 𝐴𝑗 𝑜𝑟 𝐴𝑖 𝑎𝑛𝑑 𝐵. 3. Assignments which set 𝐵 = 𝐴𝑖 and then set 𝐴𝑗 = 𝐵 or 𝐴𝑗 = 𝐴𝑖 . Generally the complexity function measures only the number of comparisons, since the number of other operations is at most a constant factor of the number of other operations is at most a constant factor of the number of comparisons. Suppose space is fixed for one algorithm then only run time will be considered for obtaining the complexity of algorithm [5,4]. Complexity analysis of the proposed SR Sorting Algorithm for best case and worst case is discussed here with the help of examples. A. Best Case: In this case the array is already sorted and the terminating conditions is obtained after traversing the array twice. In this case, the complexity of the SR algorithm is𝑂(𝑛 (log √ 𝑛)). Figure. 2. Best Case SRS Algorithm.
  • 3. © 2019 JETIR June 2019, Volume 6, Issue 6 www.jetir.org (ISSN-2349-5162) JETIR1906780 Journal of Emerging Technologies and Innovative Research (JETIR) www.jetir.org 360 B. Average Case: In this case the array data items used the random number, In this case, the complexity of the SR algorithm is 𝑂((𝑛 log √ 𝑛) + 𝑐𝑛). Figure. 3. Average Case SRS Algorithm. C. Worst Case: Reverse sorted array which involves every element to be moved to (𝑛 + 1)𝑡ℎ position from its initial 𝑖 𝑡ℎ position. In this case, the complexity of the SR algorithm is 𝑂(𝑛(log √ 𝑛) + 𝑐𝑛). Figure. 4. Worst Case SRS Algorithm. IV. COMPARE SRS ALGORITHM WITH OTHER SORTING ALGORITHM Which sorting algorithm is the fastest? This question doesn't have an easy or unambiguous answer, however. The speed of sorting can depend quite heavily on the environment where the sorting is done, the type of items that are sorted and the distribution of these items. For example, sorting a database which is so big that cannot fit into memory all at once is quite different from sorting an array of 100 integers. Not only will the implementation of the algorithm be quite different, naturally, but it may even be that the same algorithm which is fast in one case is slow in the other. Also sorting an array may be different from sorting a linked list, for example [1]. In order to better understand the advantages and disadvantages of an algorithm, there is a need for time that the algorithm should be adapted in different criteria’s so that the results obtained can be examined in order to understand the advantages and disadvantages of the algorithm. When we discuss the complexity of the SR algorithm, we have achieved the results after it was implemented in Java programming language which indicates that the algorithm performs a comparative and substitute comparison with previous algorithms.
  • 4. © 2019 JETIR June 2019, Volume 6, Issue 6 www.jetir.org (ISSN-2349-5162) JETIR1906780 Journal of Emerging Technologies and Innovative Research (JETIR) www.jetir.org 361 This algorithm can still be called a technique that replaces any sorting algorithm that exists up to now or in the future in order to reduce the time complexity of the algorithm and when we compare merge sort with this algorithm, the results obtained from 100 to 102400 data items are presented in the following way: Figure. 5. Compare Merge Sort with SR-Sort at the best case. Figure. 6. Compare Merge Sort with SR-Sort at the average case . Figure. 7. Compare Merge Sort with SR-Sort at the best case The following table illustrates the complexity of some sorting algorithms with SR sorting algorithms. ALGORITHMS BEST CASE AVERAGE CASE WORST CASE SR Sort 𝑛 log(√ 𝑛) 𝑛 log(√ 𝑛) + 𝑐𝑛 𝑛 log(√ 𝑛) + 𝑐𝑛 Merge Sort 𝑛 log(𝑛) 𝑛 log(𝑛) 𝑛 log(𝑛) Bubble Sort 𝑛 𝑛2 𝑛2 Insertion Sort 𝑛 𝑛2 𝑛2
  • 5. © 2019 JETIR June 2019, Volume 6, Issue 6 www.jetir.org (ISSN-2349-5162) JETIR1906780 Journal of Emerging Technologies and Innovative Research (JETIR) www.jetir.org 362 Selection Sort 𝑛2 𝑛2 𝑛2 V. CONCLUSION In this research paper, we discussed the SR algorithm. The performance of the algorithm and comparison with other existing algorithms in terms of time and space complexity. This algorithm is one of the best algorithms with less time and space complexity, especially in best case and better performance in worst case than some other existing algorithms. In case of time complexity, the SR algorithm has better performance than Insertion Sort, Bubble Sort and Selection Sort. And in case of best case, it performs better than merge sort although merge sort performs better in worst case. VI. ACKNOWLEDGEMENTS First of all, I would like to thank the most merciful and the most gracious Allah who teaches and shows us the way of happiness of this and next word by the agency of his messenger the owner of honor Mohammad (peace be open him) and give command for learning the knowledge. I am grateful from the all lectures especially my supervisor Asst.Prof.Ms NISHA GAUTAM for his valuable contributions, patience and guidance through this study. I am grateful to my parents for their hidden help in terms of prayers and faith in me, which actually empowered me to fulfill this task. And last, I am grateful to all my entourage, classmates and companions who helped me on the journey of university career and made it easier. I would also like to thank my entourage, classmates and companions especially from my partner Eng. Ehsan Bayat who helped me on the journey of university career and made it easier. And last but not least, I am grateful to my parents for their hidden help in terms of prayers and faith in me, which actually empowered me to fulfill this task. REFERENCES [1] Comparison of several sorting algorithms. http: //warp.povusers.org/SortComparison/ .Accessed: 2018-11-13. [2] Tata McGraw-Hill Education. Data Structures and Algorithms Using C. 2010. [3] Harish Chugh Gaurav Kumar. Empirical Study Of Complexity Graphs for Sorting Algorithms". In :( 2013). [4] seymour Lipschutz. “Data Structures With C". In: 2013 . [5] R.Mariselvi G.Santhana Devi C.Rajalakshmi C.Durai V.P.Kulalviamozhi M.Muthulakshmi. Performance Analysis of Sorting Algorithm , IEEE Journals . 2015. [6] Indradeep hayran and Pritee Khanna. Couple Sort, PDGC , 2016. [7] Hoda Osama ,Yasser Omar and Amr Badr. Mapping Sorting Alogirhtm , IEEE, July 2016. [8] Chen Hongyan, Wan Junwei, Lu Xianli , Research and implementation of database high performance sorting algorithm with big data, IEEE,2017 [9] Wei Wang, Big Data, Big Challenges , IEEE , 2014