More Subjects
Algorithms
[Author Name(s), First M. Last, Omit Titles and Degrees]
[Institutional Affiliation(s)]
Algorithms for Sorting
The algorithms that have been selected are bubble sort, insertion sort, and selection sort.
Bubble sort compares the adjacent elements to see if they are in the right order i.e. ascending or descending. If they are in the correct order, it moves to the next two elements, otherwise, the positions of the elements are swapped. Each time the full array is traversed, one element moves to the right location after each outer-loop is executed. Its best case with regards to time is O(n) and worst is O(n^2). It involves two loops and each time the first loop is executed, the second loop executes one less time because one element is always sorted. Bubble sort is utilized for a quick implementation regardless of the time constraint demanded ADDIN ZOTERO_ITEM CSL_CITATION {"citationID":"pRfxXMnn","properties":{"formattedCitation":"(Min, 2010)","plainCitation":"(Min, 2010)","noteIndex":0},"citationItems":[{"id":93,"uris":["http://zotero.org/users/local/WKtM8IGm/items/SIRGRKYX"],"uri":["http://zotero.org/users/local/WKtM8IGm/items/SIRGRKYX"],"itemData":{"id":93,"type":"paper-conference","title":"Analysis on Bubble Sort Algorithm Optimization","container-title":"2010 International Forum on Information Technology and Applications","publisher":"IEEE","publisher-place":"Kunming, China","page":"208-211","source":"DOI.org (Crossref)","event":"2010 International Forum on Information Technology and Applications (IFITA)","event-place":"Kunming, China","URL":"http://ieeexplore.ieee.org/document/5635119/","DOI":"10.1109/IFITA.2010.9","ISBN":"978-1-4244-7622-0","author":[{"family":"Min","given":"Wang"}],"issued":{"date-parts":[["2010",7]]},"accessed":{"date-parts":[["2020",1,22]]}}}],"schema":"https://github.com/citation-style-language/schema/raw/master/csl-citation.json"} (Min, 2010).
Insertion sort is another sorting algorithm. It works by traversing through the list of elements and checking if that particular element is in the right order. If the element is not in the right order, it is placed in the right position and then the algorithm moves onto the next element. The process ends when the list is fully sorted. The best case for the insertion sort is O(n) and the worst is O(n^2). Insertion sort is used when the list size is small as it would cause issues for larger lists ADDIN ZOTERO_ITEM CSL_CITATION {"citationID":"3ZveNhEg","properties":{"formattedCitation":"(Wang Min, 2010)","plainCitation":"(Wang Min, 2010)","noteIndex":0},"citationItems":[{"id":95,"uris":["http://zotero.org/users/local/WKtM8IGm/items/IX6KPWI7"],"uri":["http://zotero.org/users/local/WKtM8IGm/items/IX6KPWI7"],"itemData":{"id":95,"type":"paper-conference","title":"Analysis on 2-element insertion sort algorithm","container-title":"2010 International Conference On Computer Design and Applications","publisher":"IEEE","publisher-place":"Qinhuangdao, China","page":"V1-143-V1-146","source":"DOI.org (Crossref)","event":"2010 International Conference on Computer Design and Applications (ICCDA 2010)","event-place":"Qinhuangdao, China","URL":"http://ieeexplore.ieee.org/document/5541165/","DOI":"10.1109/ICCDA.2010.5541165","ISBN":"978-1-4244-7164-5","author":[{"literal":"Wang Min"}],"issued":{"date-parts":[["2010",6]]},"accessed":{"date-parts":[["2020",1,22]]}}}],"schema":"https://github.com/citation-style-language/schema/raw/master/csl-citation.json"} (Wang Min, 2010).
The third type of sorting technique is called selection sort. Let us consider a list that is to be sorted. The sorting order is ascending. The selection sort algorithm would take the minimum value element and then place it at the beginning. The process would continue till the entire list is perfectly sorted. When talking about selection sort, the best time complexity is O (n^2) while its worst-case complexity is also O (n^2). Selection sort is also utilized when time is not an issue and easy implementation is demanded. If properly optimized, selection sort may be quicker than the insertion sort ADDIN ZOTERO_ITEM CSL_CITATION {"citationID":"oTeyyzmt","properties":{"formattedCitation":"(Jadoon et al., 2011)","plainCitation":"(Jadoon et al., 2011)","noteIndex":0},"citationItems":[{"id":94,"uris":["http://zotero.org/users/local/WKtM8IGm/items/UGR6MH3D"],"uri":["http://zotero.org/users/local/WKtM8IGm/items/UGR6MH3D"],"itemData":{"id":94,"type":"article-journal","title":"Optimized selection sort algorithm is faster than insertion sort algorithm: a comparative study","container-title":"International Journal of Electrical & Computer Sciences IJECS-IJENS","page":"19-24","volume":"11","issue":"02","author":[{"family":"Jadoon","given":"Sultanullah"},{"family":"Solehria","given":"Salman Faiz"},{"family":"Qayum","given":"Mubashir"}],"issued":{"date-parts":[["2011"]]}}}],"schema":"https://github.com/citation-style-language/schema/raw/master/csl-citation.json"} (Jadoon et al., 2011).
I would choose bubble sort as it is among the quickest algorithms that have been listed. It has the most efficient best-case time complexity. Furthermore, it is one of the easiest algorithms to implement so it would be my main choice for an algorithm when implementing in the application.
The pseudocode for the implementation of bubble sort is as follows. ‘ar’ is the array of total size ‘p’.
for s =1 to p
for k = 0 to p-1
if a[k]>a[k+1]
swap(ar[k], ar[k+1])
References
ADDIN ZOTERO_BIBL {"uncited":[],"omitted":[],"custom":[]} CSL_BIBLIOGRAPHY Jadoon, S., Solehria, S. F., & Qayum, M. (2011). Optimized selection sort algorithm is faster than insertion sort algorithm: a comparative study. International Journal of Electrical & Computer Sciences IJECS-IJENS, 11(02), 19–24.
Min, W. (2010). Analysis on Bubble Sort Algorithm Optimization. 2010 International Forum on Information Technology and Applications, 208–211. https://doi.org/10.1109/IFITA.2010.9
Wang Min. (2010). Analysis on 2-element insertion sort algorithm. 2010 International Conference On Computer Design and Applications, V1-143-V1-146. https://doi.org/10.1109/ICCDA.2010.5541165
More Subjects
Join our mailing list
@ All Rights Reserved 2023 info@freeessaywriter.net