Defining a Modified Cycle Sort Algorithm and Parallel Critique with Other Sorting Algorithms (GRDJE/ Volume 5 / Issue 5 / 001)

Total Page:16

File Type:pdf, Size:1020Kb

Defining a Modified Cycle Sort Algorithm and Parallel Critique with Other Sorting Algorithms (GRDJE/ Volume 5 / Issue 5 / 001) GRD Journals- Global Research and Development Journal for Engineering | Volume 5 | Issue 5 | April 2020 ISSN- 2455-5703 Defining a Modified Cycle Sort Algorithm and Parallel Critique with other Sorting Algorithms Nakib Aman Turzo Lecturer Department of Computer Science and Engineering Varendra University Pritom Sarker Biplob Kumar Student Student Department of Computer Science and Engineering Department of Computer Science and Engineering Varendra University Varendra University Jyotirmoy Ghose Amit Chakraborty Student Student Department of Computer Science and Engineering Department of Computer Science and Engineering National Institute of Technology, Rourkela Varendra University Abstract Professionals of computer sciences have to confront with different complexities and problems. The pivot point of the problem which requires the focus is sorting algorithm. Sorting is the rearrangement of items or integers in an ordered way. In this research platform a modified cycle sort algorithm was devised and then comparative study of different sorting algorithms like Selection sort, Merge sort, Cycle sort and Bubble sort is being done. We also used other variety of other sorting algorithms with it. An entirely modified concept which is being sorted out. A program instigated in python has been used for gauging of CPU time taken by each algorithm. Results were obtained after cataloguing and graphically represented. For core precision program was casted a number of times and it’s concluded that modified cycle sort was the best option among all linear sorting algorithms where we have duplicate data and for large inputs efficiency has also ascended. Keywords- Sorting Algorithms, Cycle Sort, Merge Sort, Bubble Sort, Selection Sort, Time Complexity I. INTRODUCTION An algorithm is an explicit, precise, unambiguous, mechanically executable sequence of elementary instructions, usually intended to accomplish a specific purpose. Sorting is the rejigging of deets in an ordered sequence. Computer technology is incessantly maturing, and new frameworks are being instigated to the market. The plot of different mechanisms with multiple cores involves programming for many analytical processors working separately. The application is aligned on dedicated assortment of concerns for effective information managing. These facets make it viable to manage even more details in various databases. Algorithms that are most useful are different sorting methods. The data constituents which needs to be sorted are normally stored in array data structure to amass it in accordance to data elements. Most software applications sort data in ascending or descending order that is why sorting algorithms have a paramount importance in these tasks. There are many fundamental and evolved sorting methods which are used for specific purpose. It is of key importance because it enhances the usefulness of data. It has risen in parallel with human mind burgeoning. Flourishment of information leads to increase in sort algorithms establishment. Their progress plummeted the complexity and allured a great deal of research. From finding a word from dictionary to finding a number or address from a directory is not so vapid now. Several sorting algorithms are present today like merge sort, bubble sort, insertion sort, quick sort, selection sort and each one of them has separate mechanism to organize various elements so that performance and efficiency get rocketed. While doing comparison there are many factors which must be taken into account like time complexity i.e. the proportion of time taken by the sorting algorithm to trot. This factor is quiet vary in every sorting algorithm because of the bulk of data and may be inefficient or too slow. The time complexity can be depicted as O (n) notation. Here O represents complexity and n represents the number of elementary operations done. Second factor which is focused is stability i.e. algorithms keep the constituents with same values in the same sequence in modified array. Some sorting algorithms are stable by nature like insertion sort, merge sort, bubble sort while others are not stable and need to be modified to stable. The third factor is memory space which depicts that most sorting algorithms which use recursive techniques cover more memory. In this article, we have used our analytical approach to compare different sorting algorithms with newly devised counting (cycle) sort algorithm by modifying a previous one and tried to elaborate it in a simple way. Also presented some previous comparative studies of different people who have done it exceptionally. It’s a stark reality that critical research is the base of knowledge. All rights reserved by www.grdjournals.com 1 Defining a Modified Cycle Sort Algorithm and Parallel Critique with other Sorting Algorithms (GRDJE/ Volume 5 / Issue 5 / 001) II. LITERATURE REVIEW There are various groundwork or analysis available in determination of complexity of sorting algorithms. In comparative study of some parallel sort algorithms such as map sort, merge sort, parallel quick sort, alternative quick sort and the intent was to introduce merge sort algorithm and its capability to sort n-sized array of elements. Maintaining the Integrity of the Specifications. The stratagem adopted was divide and conquer method. Pragmatic and postulator analysis of merge sort algorithm was presented in addition to its pseudo codes. Merge sort was compared with bubble, insertion and selection and manifests that merge sort is faster than insertion sort with a ratio of 24 to 241 times and using n-values of 10,000 and 60,000 respectively. Results also showed that difference between merge and insertion sort is significant with 90% confidence [1, 6]. A practical performance was done by comparing odd-even transposition sort, parallel rank sort, and parallel merge sort [7]. There are many studies which addressed problems associated to dedicated and parallel machines; but a little research has been carried out on performance evaluation of parallel sorting algorithms on clustered stations. Hence, the aim of the study is to compare some parallel sorting algorithms with overall execution time as performance parameter. Algorithms taken into consideration include odd-even transposition sort, parallel rank sort, and parallel merge sort. These algorithms were evaluated in the same way as done by [6]. In theory, the odd-even transposition has a complexity of O (bn2); such that b = 1/2p2. This implicates that the time will be decreased by ‘b’. Similarly, in theory parallel rank sort has a complexity of O (cn2); c = 1/p. The theoretical complexity of parallel merge sort is O (n/p log n/p). ‘P’ is number of processes. Empirical results have shown that fastest one is parallel merge technique. This is followed by the odd-even transposition algorithm, while the slowest is the parallel rank sorting algorithm [2, 8]. In a study of Bubble, Insertion, Quick, Merge and Heap sorting algorithms on 100000, 300000, 500000, 700000, 1000000, 1500000 input values. After analyzing the data empirically algorithms were ranked in the order prescribed below with respect to speed. 1. Merge 2. Quick 3. Heap 4. Insertion 5. Bubble Merge, quickly and heap sort algorithms are faster than the remaining two because of large input size [9]. In another study bubble, insertion, selection, merge and quick sort algorithms on the input values 10, 100, 1000 and 10000. Average running time was noted on these inputs and presented graphically and concluded that the most effective and efficient algorithm was quick sort [10]. Algorithms complexity was determined by variety of criteria’s. In a study it was defined that time needed by an algorithm expressed as a function of the size of a problem is called time complexity and limiting behavior of complexity as size increases is called asymptomatic time complexity. It’s the complexity of an algorithm which determines the size of problem that can be achieved with an increase in computer speed [11]. An empirical comparison of runtime of five sorting algorithms was done to determine which one is fastest to sort lists of different lengths and to determine which algorithms to be used. Other factors were also taken into account in order to guarantee a high-quality product [12].In a research, sorting methods were divided into two categories. If data are sorted at a time in main memory it will be internal sorting but if data are sorted in auxiliary memory, it's called external memory [5, 13].In another study analysis of no-comparison based sorting algorithms was done which make assumptions about the input. All elements are required to fall within a range of constant length in order to ensure linear time complexity. On the other hand comparison based sorting algorithms make no assumption about input and are able to address any case [6, 14]. In an investigative study, different types of sorting algorithms for the allocation of CPU, as it is mastermind of computer. Scheduling of CPU is the basis of effective utilization of various resources which are attached to CPU. In this process allocation of CPU to a particular time was done so that we can take maximum usage from it. It involves the careful examination of pending processes to determine the most efficient way to service the request [15]. Processing time of four sorting algorithms was taken with index sort and it was noted that which algorithm takes less time to sort elements. If any algorithm takes less processing time which means that it sorts elements faster than others. The processing time depends on processing speed of a processor as well as internal memory used by system. It was concluded that index sort algorithm is working well for all length of input values. It took less CPU time than other sorting algorithms for small inputs. More effective sorting algorithm can be proposed with running time [3, 16]. Analysis of robustness of sorting and tournament algorithms against faulty comparisons. Sorting algorithms were affected differently by faulty comparisons depending on how comparison errors can affect the overall result.
Recommended publications
  • An Evolutionary Approach for Sorting Algorithms
    ORIENTAL JOURNAL OF ISSN: 0974-6471 COMPUTER SCIENCE & TECHNOLOGY December 2014, An International Open Free Access, Peer Reviewed Research Journal Vol. 7, No. (3): Published By: Oriental Scientific Publishing Co., India. Pgs. 369-376 www.computerscijournal.org Root to Fruit (2): An Evolutionary Approach for Sorting Algorithms PRAMOD KADAM AND Sachin KADAM BVDU, IMED, Pune, India. (Received: November 10, 2014; Accepted: December 20, 2014) ABstract This paper continues the earlier thought of evolutionary study of sorting problem and sorting algorithms (Root to Fruit (1): An Evolutionary Study of Sorting Problem) [1]and concluded with the chronological list of early pioneers of sorting problem or algorithms. Latter in the study graphical method has been used to present an evolution of sorting problem and sorting algorithm on the time line. Key words: Evolutionary study of sorting, History of sorting Early Sorting algorithms, list of inventors for sorting. IntroDUCTION name and their contribution may skipped from the study. Therefore readers have all the rights to In spite of plentiful literature and research extent this study with the valid proofs. Ultimately in sorting algorithmic domain there is mess our objective behind this research is very much found in documentation as far as credential clear, that to provide strength to the evolutionary concern2. Perhaps this problem found due to lack study of sorting algorithms and shift towards a good of coordination and unavailability of common knowledge base to preserve work of our forebear platform or knowledge base in the same domain. for upcoming generation. Otherwise coming Evolutionary study of sorting algorithm or sorting generation could receive hardly information about problem is foundation of futuristic knowledge sorting problems and syllabi may restrict with some base for sorting problem domain1.
    [Show full text]
  • Sorting Algorithm 1 Sorting Algorithm
    Sorting algorithm 1 Sorting algorithm In computer science, a sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order. Efficient sorting is important for optimizing the use of other algorithms (such as search and merge algorithms) that require sorted lists to work correctly; it is also often useful for canonicalizing data and for producing human-readable output. More formally, the output must satisfy two conditions: 1. The output is in nondecreasing order (each element is no smaller than the previous element according to the desired total order); 2. The output is a permutation, or reordering, of the input. Since the dawn of computing, the sorting problem has attracted a great deal of research, perhaps due to the complexity of solving it efficiently despite its simple, familiar statement. For example, bubble sort was analyzed as early as 1956.[1] Although many consider it a solved problem, useful new sorting algorithms are still being invented (for example, library sort was first published in 2004). Sorting algorithms are prevalent in introductory computer science classes, where the abundance of algorithms for the problem provides a gentle introduction to a variety of core algorithm concepts, such as big O notation, divide and conquer algorithms, data structures, randomized algorithms, best, worst and average case analysis, time-space tradeoffs, and lower bounds. Classification Sorting algorithms used in computer science are often classified by: • Computational complexity (worst, average and best behaviour) of element comparisons in terms of the size of the list . For typical sorting algorithms good behavior is and bad behavior is .
    [Show full text]
  • Evaluation of Sorting Algorithms, Mathematical and Empirical Analysis of Sorting Algorithms
    International Journal of Scientific & Engineering Research Volume 8, Issue 5, May-2017 86 ISSN 2229-5518 Evaluation of Sorting Algorithms, Mathematical and Empirical Analysis of sorting Algorithms Sapram Choudaiah P Chandu Chowdary M Kavitha ABSTRACT:Sorting is an important data structure in many real life applications. A number of sorting algorithms are in existence till date. This paper continues the earlier thought of evolutionary study of sorting problem and sorting algorithms concluded with the chronological list of early pioneers of sorting problem or algorithms. Latter in the study graphical method has been used to present an evolution of sorting problem and sorting algorithm on the time line. An extensive analysis has been done compared with the traditional mathematical methods of ―Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, Quick Sort. Observations have been obtained on comparing with the existing approaches of All Sorts. An “Empirical Analysis” consists of rigorous complexity analysis by various sorting algorithms, in which comparison and real swapping of all the variables are calculatedAll algorithms were tested on random data of various ranges from small to large. It is an attempt to compare the performance of various sorting algorithm, with the aim of comparing their speed when sorting an integer inputs.The empirical data obtained by using the program reveals that Quick sort algorithm is fastest and Bubble sort is slowest. Keywords: Bubble Sort, Insertion sort, Quick Sort, Merge Sort, Selection Sort, Heap Sort,CPU Time. Introduction In spite of plentiful literature and research in more dimension to student for thinking4. Whereas, sorting algorithmic domain there is mess found in this thinking become a mark of respect to all our documentation as far as credential concern2.
    [Show full text]
  • Sorting Algorithm 1 Sorting Algorithm
    Sorting algorithm 1 Sorting algorithm A sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order. Efficient sorting is important for optimizing the use of other algorithms (such as search and merge algorithms) which require input data to be in sorted lists; it is also often useful for canonicalizing data and for producing human-readable output. More formally, the output must satisfy two conditions: 1. The output is in nondecreasing order (each element is no smaller than the previous element according to the desired total order); 2. The output is a permutation (reordering) of the input. Since the dawn of computing, the sorting problem has attracted a great deal of research, perhaps due to the complexity of solving it efficiently despite its simple, familiar statement. For example, bubble sort was analyzed as early as 1956.[1] Although many consider it a solved problem, useful new sorting algorithms are still being invented (for example, library sort was first published in 2006). Sorting algorithms are prevalent in introductory computer science classes, where the abundance of algorithms for the problem provides a gentle introduction to a variety of core algorithm concepts, such as big O notation, divide and conquer algorithms, data structures, randomized algorithms, best, worst and average case analysis, time-space tradeoffs, and upper and lower bounds. Classification Sorting algorithms are often classified by: • Computational complexity (worst, average and best behavior) of element comparisons in terms of the size of the list (n). For typical serial sorting algorithms good behavior is O(n log n), with parallel sort in O(log2 n), and bad behavior is O(n2).
    [Show full text]
  • Comparison Sorts Name Best Average Worst Memory Stable Method Other Notes Quicksort Is Usually Done in Place with O(Log N) Stack Space
    Comparison sorts Name Best Average Worst Memory Stable Method Other notes Quicksort is usually done in place with O(log n) stack space. Most implementations on typical in- are unstable, as stable average, worst place sort in-place partitioning is case is ; is not more complex. Naïve Quicksort Sedgewick stable; Partitioning variants use an O(n) variation is stable space array to store the worst versions partition. Quicksort case exist variant using three-way (fat) partitioning takes O(n) comparisons when sorting an array of equal keys. Highly parallelizable (up to O(log n) using the Three Hungarian's Algorithmor, more Merge sort worst case Yes Merging practically, Cole's parallel merge sort) for processing large amounts of data. Can be implemented as In-place merge sort — — Yes Merging a stable sort based on stable in-place merging. Heapsort No Selection O(n + d) where d is the Insertion sort Yes Insertion number of inversions. Introsort No Partitioning Used in several STL Comparison sorts Name Best Average Worst Memory Stable Method Other notes & Selection implementations. Stable with O(n) extra Selection sort No Selection space, for example using lists. Makes n comparisons Insertion & Timsort Yes when the data is already Merging sorted or reverse sorted. Makes n comparisons Cubesort Yes Insertion when the data is already sorted or reverse sorted. Small code size, no use Depends on gap of call stack, reasonably sequence; fast, useful where Shell sort or best known is No Insertion memory is at a premium such as embedded and older mainframe applications. Bubble sort Yes Exchanging Tiny code size.
    [Show full text]
  • Scheduling and Sorting Algorithms for Robotic Warehousing Systems
    Scheduling and Sorting Algorithms for Robotic Warehousing Systems Master Thesis Daniel Graf July 18, 2015 Advisors: Prof. Dr. P. Widmayer and K. B¨ohmov´a Department of Computer Science, ETH Z¨urich Abstract Automated storage and retrieval systems are used in many warehouses for time and space efficient stocking and order fulfilment. In this thesis, we study such automated systems in the context of storing bicycles at a train station, where commuters bring their bicycles in the morning and reclaim them in the evening. The commuters place their bicycles in a box at a door, where a robot then moves it underground for safe storage. In the first part of the thesis, we investigate how the robot best assigns boxes to the underground storage slots. The goal is to find a schedule which allows the robot to meet all the customers at the door without causing any waiting time. For a single door, we devise an efficient al- gorithm that finds such an optimal schedule under certain conditions. If there is a second door, or arriving and departing customers are heav- ily interleaved, we show that it is -complete for the robot to find a wait-free schedule even if it knowsNP all the requests in advance. In the second part of the thesis, we focus on the task of rearranging the stored boxes in between customer interactions. We phrase the task as a compelling physical sorting problem: on every vertex of a graph G, we place a box. The n vertices and n boxes are each numbered from 1 to n, and initially shuffled according to a permutation p.
    [Show full text]
  • Sorting Algorithms Bubble Sort Selection Sort Insertion Sort
    Sorting Algorithms I Analysis and Design of Algorithms Sorting Algorithms Bubble Sort Selection Sort Insertion Sort Analysis and Design of Algorithms Sorting Algorithm is an algorithm made up of a series of instructions that takes an array as input, and outputs a sorted array. There are many sorting algorithms, such as: . Selection Sort, Bubble Sort, Insertion Sort, Merge Sort, Heap Sort, QuickSort, Radix Sort, Counting Sort, Bucket Sort, ShellSort, Comb Sort, Pigeonhole Sort, Cycle Sort Analysis and Design of Algorithms Bubble Sort Analysis and Design of Algorithms Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order. Analysis and Design of Algorithms Algorithm: . Step1: Compare each pair of adjacent elements in the list . Step2: Swap two element if necessary . Step3: Repeat this process for all the elements until the entire array is sorted Analysis and Design of Algorithms Example 1 Assume the following Array: 5 1 4 2 Analysis and Design of Algorithms First Iteration: Compare 5 1 4 2 j j+1 Analysis and Design of Algorithms First Iteration: Swap 1 5 4 2 j j+1 Analysis and Design of Algorithms First Iteration: Compare 1 5 4 2 j j+1 Analysis and Design of Algorithms First Iteration: Swap 1 4 5 2 j j+1 Analysis and Design of Algorithms First Iteration: Compare 1 4 5 2 j j+1 Analysis and Design of Algorithms First Iteration: Swap 1 4 2 5 j j+1 Analysis and Design of Algorithms 1 4 2 5 Analysis and Design of Algorithms Second Iteration:
    [Show full text]
  • Contents Classification Comparison of Algorithms Popular Sorting
    From Wikipedia, the free encyclopedia A sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order. Efficient sorting is important for optimizing the use of other algorithms (such as search and merge algorithms) which require input data to be in sorted lists; it is also often useful for canonicalizing data and for producing human- readable output. More formally, the output must satisfy two conditions: 1. The output is in nondecreasing order (each element is no smaller than the previous element according to the desired total order); 2. The output is a permutation (reordering) of the input. Further, the data is often taken to be in an array, which allows random access, rather than a list, which only allows sequential access, though often algorithms can be applied with suitable modification to either type of data. Since the dawn of computing, the sorting problem has attracted a great deal of research, perhaps due to the complexity of solving it efficiently despite its simple, familiar statement. For example, bubble sort was analyzed as early as 1956.[1] Comparison sorting algorithms have a fundamental requirement of O(n log n) comparisons (some input sequences will require a multiple of n log n comparisons); algorithms not based on comparisons, such as counting sort, can have better performance. Although many consider sorting a solved problem—asymptotically optimal algorithms have been known since the mid-20th century—useful new algorithms are still being invented, with the now widely used Timsort dating to 2002, and the library sort being first published in 2006.
    [Show full text]
  • CSE373: Data Structure & Algorithms Comparison Sorting
    Sorting Riley Porter CSE373: Data Structures & Algorithms 1 Introduction to Sorting • Why study sorting? – Good algorithm practice! • Different sorting algorithms have different trade-offs – No single “best” sort for all scenarios – Knowing one way to sort just isn’t enough • Not usually asked about on tech interviews... – but if it comes up, you look bad if you can’t talk about it CSE373: Data Structures2 & Algorithms More Reasons to Sort General technique in computing: Preprocess data to make subsequent operations faster Example: Sort the data so that you can – Find the kth largest in constant time for any k – Perform binary search to find elements in logarithmic time Whether the performance of the preprocessing matters depends on – How often the data will change (and how much it will change) – How much data there is CSE373: Data Structures & 3 Algorithms Definition: Comparison Sort A computational problem with the following input and output Input: An array A of length n comparable elements Output: The same array A, containing the same elements where: for any i and j where 0 i < j < n then A[i] A[j] CSE373: Data Structures & 4 Algorithms More Definitions In-Place Sort: A sorting algorithm is in-place if it requires only O(1) extra space to sort the array. – Usually modifies input array – Can be useful: lets us minimize memory Stable Sort: A sorting algorithm is stable if any equal items remain in the same relative order before and after the sort. – Items that ’compare’ the same might not be exact duplicates – Might want to sort on some, but not all attributes of an item – Can be useful to sort on one attribute first, then another one CSE373: Data Structures & 5 Algorithms Stable Sort Example Input: [(8, "fox"), (9, "dog"), (4, "wolf"), (8, "cow")] Compare function: compare pairs by number only Output (stable sort): [(4, "wolf"), (8, "fox"), (8, "cow"), (9, "dog")] Output (unstable sort): [(4, "wolf"), (8, "cow"), (8, "fox"), (9, "dog")] CSE373: Data Structures & 6 Algorithms Lots of algorithms for sorting..
    [Show full text]
  • Sorting Algorithms
    Lecture 15: Sorting CSE 373: Data Structures and Algorithms Algorithms CSE 373 WI 19 - KASEY CHAMPION 1 Administrivia Piazza! Homework - HW 5 Part 1 Due Friday 2/22 - HW 5 Part 2 Out Friday, due 3/1 - HW 3 Regrade Option due 3/1 Grades - HW 1, 2 & 3 Grades into Canvas soon - Socrative EC status into Canvas soon - HW 4 Grades published by 3/1 - Midterm Grades PubLished CSE 373 SP 18 - KASEY CHAMPION 2 Midterm Stats CSE 373 19 WI - KASEY CHAMPION 3 Sorting CSE 373 19 WI - KASEY CHAMPION 4 Types of Sorts Comparison Sorts Niche Sorts aka “linear sorts” Compare two elements at a time Leverages specific properties about the General sort, works for most types of elements items in the list to achieve faster Element must form a “consistent, total ordering” runtimes For every element a, b and c in the list the niche sorts typically run O(n) time following must be true: - If a <= b and b <= a then a = b In this class we’ll focus on comparison - If a <= b and b <= c then a <= c sorts - Either a <= b is true or <= a What does this mean? compareTo() works for your elements Comparison sorts run at fastest O(nlog(n)) time CSE 373 SP 18 - KASEY CHAMPION 5 Sort Approaches In Place sort A sorting algorithm is in-place if it requires only O(1) extra space to sort the array Typically modifies the input collection Useful to minimize memory usage Stable sort A sorting algorithm is stable if any equal items remain in the same relative order before and after the sort Why do we care? - Sometimes we want to sort based on some, but not all attributes of an item -
    [Show full text]
  • CSE 332: Comparison Sorts
    CSE 332: Comparison Sorts Michael Lee Wednesday, February 1, 2016 1 Why bother? Why not just use Collections.sort()? 2 Why study sorting? Tradeoffs I There is no ‘best’ sorting algorithm. I DIfferent sorts have different purposes/tradeoffs. Tech interviews I Nobody asks about sorting on interviews... I ...but if it comes up, you look bad if you can’t talk about it. 3 Definition: Comparison Sort SORT is a computational problem with the following preconditions and postconditions: Preconditions (input) An array A of length n where each element is of type E A consistent, total ordering on all elements of type E: compare(a, b) Postconditions (outputs) For all 0 ≤ i < j < n, A[k] ≤ A[j] Every item in the original array must be in the sorted array A comparison sort algorithm solves SORT. 4 More definitions In-place sort A sorting algorithm is in-place if it requires only O(1) extra space to sort the array. I Usually modifies input array I Can be useful: lets us minimize memory 5 More definitions Stable sort A sorting algorithm is stable if any equal items remain in the same relative order before and after the sort. I Observation: We sometimes want to sort on some, but not all attribute of an item I Items that ’compare’ the same might not be exact duplicates I Sometimes useful to sort on one attribute first, then another one 6 Stable sort: Example Input: I Array: [(8, "fox"), (9, "dog"), (4, "wolf"), (8, "cow")] I Compare function: compare pairs by number only Output; stable sort: [(4, "wolf"), (8, "fox"), (8, "cow"), (9, "dog")] Output; unstable sort: [(4, "wolf"), (8, "cow"), (8, "fox"), (9, "dog")] 7 Overview of sorting algorithms There are many sorts..
    [Show full text]
  • Performances of Modified Diminishing Increment Sorting in Improving the Performances of Some Sorting Algorithms
    Oyelami Olufemi Moses Performances of Modified Diminishing Increment Sorting In Improving the Performances of Some Sorting Algorithms Oyelami Olufemi Moses [email protected] College of Computing and Communication Studies Computer Science Programme Bowen University Iwo, Nigeria Abstract There are several sorting algorithms in existence. Some are well known while others are not so well known, but important. However, more and more are still being developed to take care of the weaknesses of the existing ones and to make sorting simpler to implement. One of such new algorithms is the Modified Diminishing Increment Sorting (MDIS). In this article, a review is carried out of this algorithm and the several existing algorithms it has been employed to improve. In addition, a variant of MDIS christened Circlesort which applies MDIS in a recursive manner is also presented. Its performance comparisons with MDIS and other notable algorithms in the b est case, average case and the worst case are presented. This review will help prospective application developers that need to implement sorting determine when MDIS and its variant are strong and when the algorithms compared with them also have their own strengths so as to guide their choices. Keywords: Diminishing Increment Sorting, Modified Diminishing Increment Sorting, Performance. Efficiency, Circlesort, Shellsort, Improved Shellsort, Oyelami’s Sort. 1. INTRODUCTION Sorting is considered to be the most fundamental problem in the study of algorithms [1]. This is why this subject is worth considering. The more sorting algorithms there are, the better and the merrier because different sorting algorithms are suitable for different data characteristics and according to Donald Ervin Knuth, who is a renowned computer scientist and the author of one of the most respected references in computer science, “There is no known ‘best’ way to sort; there are many best methods, depending on what is to be sorted, on what machine and for what purpose” [2].
    [Show full text]