Strategies for Stable Merge Sorting

Total Page:16

File Type:pdf, Size:1020Kb

Strategies for Stable Merge Sorting Strategies for Stable Merge Sorting Sam Buss∗ Alexander Knop∗ Abstract relative order of pairs of entries in the input list. We introduce new stable natural merge sort algorithms, Information-theoretic considerations imply that any called 2-merge sort and α-merge sort. We prove upper and comparison-based sorting algorithm must make at least lower bounds for several merge sort algorithms, including log2(n!) ≈ n log2 n comparisons in the worst case. How- Timsort, Shiver's sort, α-stack sorts, and our new 2-merge ever, in many practical applications, the input is fre- and α-merge sorts. The upper and lower bounds have quently already partially sorted. There are many adap- the forms c · n log m and c · n log n for inputs of length n tive sort algorithms which will detect this and run faster comprising m runs. For Timsort, we prove a lower bound of on inputs which are already partially sorted. Natu- (1:5−o(1))n log n. For 2-merge sort, we prove optimal upper ral merge sorts are adaptive in this sense: they detect and lower bounds of approximately (1:089 ± o(1))n log m. sorted sublists (called \runs") in the input, and thereby We state similar asymptotically matching upper and lower reduce the cost of merging sublists. One very popular bounds for α-merge sort, when ' < α < 2, where ' is the stable natural merge sort is the eponymous Timsort of golden ratio. Tim Peters [25]. Timsort is extensively used, as it is in- Our bounds are in terms of merge cost; this upper cluded in Python, in the Java standard library, in GNU bounds the number of comparisons and accurately models Octave, and in the Android operating system. Timsort runtime. The merge strategies can be used for any stable has worst-case runtime O(n log n), but is designed to merge sort, not just natural merge sorts. The new 2- run substantially faster on inputs which are partially merge and α-merge sorts have better worst-case merge pre-sorted by using intelligent strategies to determine cost upper bounds and are slightly simpler to implement the order in which merges are performed. than the widely-used Timsort; they also perform better in There is extensive literature on adaptive sorts: e.g., experiments. for theoretical foundations see [21, 9, 26, 23] and for more applied investigations see [6, 12, 5, 31, 27]. The 1 Introduction present paper will consider only stable, natural merge sorts. As exemplified by the wide deployment of Tim- This paper studies stable merge sort algorithms, espe- sort, these are certainly an important class of adaptive cially natural merge sorts. We will propose new strate- sorts. We will consider the Timsort algorithm [25, 7], gies for the order in which merges are performed, and and related sorts due to Shivers [28] and Auger-Nicaud- prove upper and lower bounds on the cost of several Pivoteau [2]. We will also introduce new algorithms, the merge strategies. The first merge sort algorithm was \2-merge sort" and the \α-merge sort" for ' < α < 2 proposed by von Neumann [16, p.159]: it works by split- where ' is the golden ratio. ting the input list into sorted sublists, initially possibly The main contribution of the present paper is the lists of length one, and then iteratively merging pairs of definition of new stable merge sort algorithms, called 2- sorted lists, until the entire input is sorted. A sorting merge and α-merge sort. These have better worst-case algorithm is stable if it preserves the relative order of run times than Timsort, are slightly easier to implement elements which are not distinguished by the sort order. than Timsort, and perform better in our experiments. There are several methods of splitting the input into We focus on natural merge sorts, since they are sorted sublists before starting the merging; a merge sort so widely used. However, our central contribution is is called natural it finds the sorted sublists by detecting analyzing merge strategies and our results are applicable consecutive runs of entries in the input which are al- to any stable sorting algorithm that generates and ready in sorted order. Natural merge sorts were first merges runs, including patience sorting [5], melsort [29, proposed by Knuth [16, p.160]. 20], and split sorting [19]. Like most sorting algorithms, the merge sort is All the merge sorts we consider will use the follow- comparison-based in that it works by comparing the ing framework. (See Algorithm 1.) The input is a list of n elements, which without loss of generality may be ∗Department of Mathematics, University of California, San Diego, La Jolla, CA, USA assumed to be integers. The first logical stage of the al- Copyright c 2019 by SIAM Unauthorized reproduction of this article is prohibited gorithm (following [25]) identifies maximal length subse- Algorithm Awareness quences of consecutive entries which are in sorted order, Timsort (original) [25] 3-aware either ascending or descending. The descending subse- Timsort (corrected) [7] (4,3)-aware quences are reversed, and this partitions the input into α-stack sort [2] 2-aware \runs" R1;:::;Rm of entries sorted in non-decreasing Shivers sort [28] 2-aware order. The number of runs is m; the number of ele- 2-merge sort 3-aware P α-merge sort (ϕ<α<2) 3-aware ments in a run R is jRj. Thus i jRij = n. It is easy to see that these runs may be formed in linear time and with linear number of comparisons. Table 1: Awareness levels for merge sort algorithms Merge sort algorithms process the runs in left-to- right order starting with R1. This permits runs to be identified on-the-fly, only when needed. This means limit of the constant c. there is no need to allocate Θ(m) additional memory Algorithm 1 shows the framework for all the merge to store the runs. This also may help reduce cache sort algorithms we discuss. This is similar to what misses. On the other hand, it means that the value Auger et al. [2] call the \generic" algorithm. The m is not known until the final run is formed; thus, input S is a sequence of integers which is partitioned the natural sort algorithms do not use m except as a into monotone runs of consecutive members. The stopping condition. decreasing runs are inverted, so S is expressed as a list The runs R are called original runs. The second i R of increasing original runs R1;:::;Rm called \original logical stage of the natural merge sort algorithms re- runs". The algorithm maintains a stack Q of runs peatedly merges runs in pairs to give longer and longer Q1;:::;Q`, which have been formed from R1;:::;Rk. runs. (As already alluded to, the first and second log- Each time through the loop, it either pushes the next ical stages are interleaved in practice.) Two runs A original run, Rk+1, onto the stack Q, or it chooses a and B can be merged in linear time; indeed with only pair of adjacent runs Qi and Qi+1 on the stack and jAj + jBj − 1 many comparisons and jAj + jBj many merges them. The resulting run replaces Qi and Qi+1 movements of elements. The merge sort stops when all and becomes the new Qi, and the length of the stack original runs have been identified and merged into a decreases by one. The entries of the runs Qi are stored single run. in-place, overwriting the elements of the array which Our mathematical model for the run time of a merge held the input S. Therefore, the stack needs to hold sort algorithm is the sum, over all merges of pairs of only the positions pi (for i = 0; : : : ; ` + 1) in the input runs A and B, of jAj + jBj. We call the quantity the array where the runs Qi start, and thereby implicitly merge cost. In most situations, the run time of a natural the lengths jQij of the runs. We have p1 = 0, pointing sort algorithm can be linearly bounded in terms of its to the beginning of the input array, and for each i, we merge cost. Our main theorems are lower and upper have jQij = pi+1 − pi. The unprocessed part of S in bounds on the merge cost of several stable natural merge the input array starts at position p`+1 = p` + jQ`j. If sorts. Note that if the runs are merged in a balanced p`+1 < n, then it will be the starting position of the fashion, using a binary tree of height dlog me, then the next original run pushed onto Q. total merge cost ≤ ndlog me. (We use log to denote Algorithm 1 is called (k1; k2)-aware since its choice logarithms base 2.) Using a balanced binary tree of of what to do is based on just the lengths of the runs in merges gives a good worst-case merge cost, but it does the top k1 members of the stack Q, and since merges are not take into account savings that are available when only applied to runs in the top k2 members of Q. ([2] 1 runs have different lengths. The goal is find adaptive used the terminology \degree" instead of \aware".) In stable natural merge sorts which can effectively take all our applications, k1 and k2 are small numbers, so it advantage of different run lengths to reduce the merge is appropriate to store the runs in a stack. Usually k1 = cost, but which are guaranteed to never be much worse k2, and we write \k-aware" instead of \(k; k)-aware".
Recommended publications
  • The Analysis and Synthesis of a Parallel Sorting Engine Redacted for Privacy Abstract Approv, John M
    AN ABSTRACT OF THE THESIS OF Byoungchul Ahn for the degree of Doctor of Philosophy in Electrical and Computer Engineering, presented on May 3. 1989. Title: The Analysis and Synthesis of a Parallel Sorting Engine Redacted for Privacy Abstract approv, John M. Murray / Thisthesisisconcerned withthe development of a unique parallelsort-mergesystemsuitablefor implementationinVLSI. Two new sorting subsystems, a high performance VLSI sorter and a four-waymerger,werealsorealizedduringthedevelopment process. In addition, the analysis of several existing parallel sorting architectures and algorithms was carried out. Algorithmic time complexity, VLSI processor performance, and chiparearequirementsfortheexistingsortingsystemswere evaluated.The rebound sorting algorithm was determined to be the mostefficientamongthoseconsidered. The reboundsorter algorithm was implementedinhardware asasystolicarraywith external expansion capability. The second phase of the research involved analyzing several parallel merge algorithms andtheirbuffer management schemes. The dominant considerations for this phase of the research were the achievement of minimum VLSI chiparea,design complexity, and logicdelay. Itwasdeterminedthattheproposedmerger architecture could be implemented inseveral ways. Selecting the appropriate microarchitecture for the merger, given the constraints of chip area and performance, was the major problem.The tradeoffs associated with this process are outlined. Finally,apipelinedsort-merge system was implementedin VLSI by combining a rebound sorter
    [Show full text]
  • Algoritmi Za Sortiranje U Programskom Jeziku C++ Završni Rad
    View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by Repository of the University of Rijeka SVEUČILIŠTE U RIJECI FILOZOFSKI FAKULTET U RIJECI ODSJEK ZA POLITEHNIKU Algoritmi za sortiranje u programskom jeziku C++ Završni rad Mentor završnog rada: doc. dr. sc. Marko Maliković Student: Alen Jakus Rijeka, 2016. SVEUČILIŠTE U RIJECI Filozofski fakultet Odsjek za politehniku Rijeka, Sveučilišna avenija 4 Povjerenstvo za završne i diplomske ispite U Rijeci, 07. travnja, 2016. ZADATAK ZAVRŠNOG RADA (na sveučilišnom preddiplomskom studiju politehnike) Pristupnik: Alen Jakus Zadatak: Algoritmi za sortiranje u programskom jeziku C++ Rješenjem zadatka potrebno je obuhvatiti sljedeće: 1. Napraviti pregled algoritama za sortiranje. 2. Opisati odabrane algoritme za sortiranje. 3. Dijagramima prikazati rad odabranih algoritama za sortiranje. 4. Opis osnovnih svojstava programskog jezika C++. 5. Detaljan opis tipova podataka, izvedenih oblika podataka, naredbi i drugih elemenata iz programskog jezika C++ koji se koriste u rješenjima odabranih problema. 6. Opis rješenja koja su dobivena iz napisanih programa. 7. Cjelokupan kôd u programskom jeziku C++. U završnom se radu obvezno treba pridržavati Pravilnika o diplomskom radu i Uputa za izradu završnog rada sveučilišnog dodiplomskog studija. Zadatak uručen pristupniku: 07. travnja 2016. godine Rok predaje završnog rada: ____________________ Datum predaje završnog rada: ____________________ Zadatak zadao: Doc. dr. sc. Marko Maliković 2 FILOZOFSKI FAKULTET U RIJECI Odsjek za politehniku U Rijeci, 07. travnja 2016. godine ZADATAK ZA ZAVRŠNI RAD (na sveučilišnom preddiplomskom studiju politehnike) Pristupnik: Alen Jakus Naslov završnog rada: Algoritmi za sortiranje u programskom jeziku C++ Kratak opis zadatka: Napravite pregled algoritama za sortiranje. Opišite odabrane algoritme za sortiranje.
    [Show full text]
  • Parallel Sorting Algorithms + Topic Overview
    + Design of Parallel Algorithms Parallel Sorting Algorithms + Topic Overview n Issues in Sorting on Parallel Computers n Sorting Networks n Bubble Sort and its Variants n Quicksort n Bucket and Sample Sort n Other Sorting Algorithms + Sorting: Overview n One of the most commonly used and well-studied kernels. n Sorting can be comparison-based or noncomparison-based. n The fundamental operation of comparison-based sorting is compare-exchange. n The lower bound on any comparison-based sort of n numbers is Θ(nlog n) . n We focus here on comparison-based sorting algorithms. + Sorting: Basics What is a parallel sorted sequence? Where are the input and output lists stored? n We assume that the input and output lists are distributed. n The sorted list is partitioned with the property that each partitioned list is sorted and each element in processor Pi's list is less than that in Pj's list if i < j. + Sorting: Parallel Compare Exchange Operation A parallel compare-exchange operation. Processes Pi and Pj send their elements to each other. Process Pi keeps min{ai,aj}, and Pj keeps max{ai, aj}. + Sorting: Basics What is the parallel counterpart to a sequential comparator? n If each processor has one element, the compare exchange operation stores the smaller element at the processor with smaller id. This can be done in ts + tw time. n If we have more than one element per processor, we call this operation a compare split. Assume each of two processors have n/p elements. n After the compare-split operation, the smaller n/p elements are at processor Pi and the larger n/p elements at Pj, where i < j.
    [Show full text]
  • Longest Increasing Subsequence
    Longest increasing subsequence Longest increasing subsequence. Given a sequence of elements c1, c2, …, cn from a totally-ordered universe, find the longest increasing subsequence. Ex. 7 2 8 1 3 4 10 6 9 5. Maximum Unique Match finder Application. Part of MUMmer system for aligning entire genomes. O(n 2) dynamic programming solution. LIS is a special case of edit-distance. ・x = c1 c2 ⋯ cn. ・y = sorted sequence of ck, removing any duplicates. ・Mismatch penalty = ∞; gap penalty = 1. 1 Patience solitaire Patience. Deal cards c1, c2, …, cn into piles according to two rules: ・Can't place a higher-valued card onto a lowered-valued card. ・Can form a new pile and put a card onto it. Goal. Form as few piles as possible. first card to deal 2 Patience: greedy algorithm Greedy algorithm. Place each card on leftmost pile that fits. first card to deal 3 Patience: greedy algorithm Greedy algorithm. Place each card on leftmost pile that fits. Observation. At any stage during greedy algorithm, top cards of piles increase from left to right. first card to deal top cards 4 Patience-LIS: weak duality Weak duality. In any legal game of patience, the number of piles ≥ length of any increasing subsequence. Pf. ・Cards within a pile form a decreasing subsequence. ・Any increasing sequence can use at most one card from each pile. ▪ decreasing subsequence 5 Patience-LIS: strong duality Theorem. [Hammersley 1972] Min number of piles = max length of an IS; moreover greedy algorithm finds both. at time of insertion Pf. Each card maintains a pointer to top card in previous pile.
    [Show full text]
  • View Publication
    Patience is a Virtue: Revisiting Merge and Sort on Modern Processors Badrish Chandramouli and Jonathan Goldstein Microsoft Research {badrishc, jongold}@microsoft.com ABSTRACT In particular, the vast quantities of almost sorted log-based data The vast quantities of log-based data appearing in data centers has appearing in data centers has generated this interest. In these generated an interest in sorting almost-sorted datasets. We revisit scenarios, data is collected from many servers, and brought the problem of sorting and merging data in main memory, and show together either immediately, or periodically (e.g. every minute), that a long-forgotten technique called Patience Sort can, with some and stored in a log. The log is then typically sorted, sometimes in key modifications, be made competitive with today’s best multiple ways, according to the types of questions being asked. If comparison-based sorting techniques for both random and almost those questions are temporal in nature [7][17][18], it is required that sorted data. Patience sort consists of two phases: the creation of the log be sorted on time. A widely-used technique for sorting sorted runs, and the merging of these runs. Through a combination almost sorted data is Timsort [8], which works by finding of algorithmic and architectural innovations, we dramatically contiguous runs of increasing or decreasing value in the dataset. improve Patience sort for both random and almost-ordered data. Of Our investigation has resulted in some surprising discoveries about particular interest is a new technique called ping-pong merge for a mostly-ignored 50-year-old sorting technique called Patience merging sorted runs in main memory.
    [Show full text]
  • From Merge Sort to Timsort Nicolas Auger, Cyril Nicaud, Carine Pivoteau
    Merge Strategies: from Merge Sort to TimSort Nicolas Auger, Cyril Nicaud, Carine Pivoteau To cite this version: Nicolas Auger, Cyril Nicaud, Carine Pivoteau. Merge Strategies: from Merge Sort to TimSort. 2015. hal-01212839v2 HAL Id: hal-01212839 https://hal-upec-upem.archives-ouvertes.fr/hal-01212839v2 Preprint submitted on 9 Dec 2015 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Merge Strategies: from Merge Sort to TimSort Nicolas Auger, Cyril Nicaud, and Carine Pivoteau Universit´eParis-Est, LIGM (UMR 8049), F77454 Marne-la-Vall´ee,France fauger,nicaud,[email protected] Abstract. The introduction of TimSort as the standard algorithm for sorting in Java and Python questions the generally accepted idea that merge algorithms are not competitive for sorting in practice. In an at- tempt to better understand TimSort algorithm, we define a framework to study the merging cost of sorting algorithms that relies on merges of monotonic subsequences of the input. We design a simpler yet competi- tive algorithm in the spirit of TimSort based on the same kind of ideas. As a benefit, our framework allows to establish the announced running time of TimSort, that is, O(n log n).
    [Show full text]
  • An Efficient Implementation of Batcher's Odd-Even Merge
    254 IEEE TRANSACTIONS ON COMPUTERS, VOL. c-32, NO. 3, MARCH 1983 An Efficient Implementation of Batcher's Odd- Even Merge Algorithm and Its Application in Parallel Sorting Schemes MANOJ KUMAR, MEMBER, IEEE, AND DANIEL S. HIRSCHBERG Abstract-An algorithm is presented to merge two subfiles ofsize mitted from one processor to another only through this inter- n/2 each, stored in the left and the right halves of a linearly connected connection pattern. The processors connected directly by the processor array, in 3n /2 route steps and log n compare-exchange A steps. This algorithm is extended to merge two horizontally adjacent interconnection pattern will be referred as neighbors. pro- subfiles of size m X n/2 each, stored in an m X n mesh-connected cessor can communicate with its neighbor with a route in- processor array in row-major order, in m + 2n route steps and log mn struction which executes in t. time. The processors also have compare-exchange steps. These algorithms are faster than their a compare-exchange instruction which compares the contents counterparts proposed so far. of any two ofeach processor's internal registers and places the Next, an algorithm is presented to merge two vertically aligned This executes subfiles, stored in a mesh-connected processor array in row-major smaller of them in a specified register. instruction order. Finally, a sorting scheme is proposed that requires 11 n route in t, time. steps and 2 log2 n compare-exchange steps to sort n2 elements stored Illiac IV has a similar architecture [1]. The processor at in an n X n mesh-connected processor array.
    [Show full text]
  • Anagnostou Msc2009.Pdf
    Αναγνώστου Χρήστος, Ανάλυση Επεξεργασία και Παρουσίαση των Αλγορίθμων Ταξινόμησης Heapsort και WeakHeapsort Ανάλυση Επεξεργασία και Παρουσίαση των Αλγορίθμων Ταξινόμησης Heapsort και WeakHeapsort Αναγνώστου Χρήστος Μεταπτυχιακός Φοιτητής ∆ιπλωματική Εργασία Επιβλέπων: Παπαρρίζος Κωνσταντίνος, Καθηγητής Τμήμα Εφαρμοσμένης Πληροφορικής Πρόγραμμα Μεταπτυχιακών Σπουδών Ειδίκευσης Πανεπιστήμιο Μακεδονίας Θεσσαλονίκη Ιανουάριος 2009 Πανεπιστήμιο Μακεδονίας – ΜΠΣΕ Τμήματος Εφαρμοσμένης Πληροφορικής Αναγνώστου Χρήστος, Ανάλυση Επεξεργασία και Παρουσίαση των Αλγορίθμων Ταξινόμησης Heapsort και WeakHeapsort Θα ήθελα να ευχαριστήσω θερμά τον επιβλέποντα καθηγητή μου και καθηγητή του τμήματος Εφαρμοσμένης Πληροφορικής του Πανεπιστημίου Μακεδονίας, κ. Παπαρρίζο Κωνσταντίνο τόσο για την πολύτιμη βοήθειά του κατά τη διάρκεια εκπόνησης της εργασίας αυτής όσο και για τη γενικότερη καθοδήγησή του. Επίσης, θα ήθελα να ευχαριστήσω την οικογένεια και τους φίλους μου που με βοήθησαν σε όλη αυτή την προσπάθεια. Πανεπιστήμιο Μακεδονίας – ΜΠΣΕ Τμήματος Εφαρμοσμένης Πληροφορικής Αναγνώστου Χρήστος, Ανάλυση Επεξεργασία και Παρουσίαση των Αλγορίθμων Ταξινόμησης Heapsort και WeakHeapsort Περιεχόμενα 1 Περίληψη ............................................................................................1 2 Εισαγωγή ............................................................................................2 2.1 Αντικείμενο της εργασίας..............................................................................2 2.2 Διάρθρωση Της Εργασίας..............................................................................3
    [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]
  • Sequential Merge Sort 2 Let's Make Mergesort Parallel
    CSE341T/CSE549T 09/15/2014 Merge Sort Lecture 6 Today we are going to turn to the classic problem of sorting. Recall that given an array of numbers, a sorting algorithm permutes this array so that they are arranged in an increasing order. You are already familiar with basics of the sorting algorithm we are learning today, but we will see how to make it parallel today. 1 Reminder: Sequential Merge Sort As a reminder, here is the pseudo-code for sequential Merge Sort. MergeSort(A; n) 1 if n = 1 2 then return A 3 Divide A into two Aleft and Aright each of size n=2 0 4 Aleft =MERGESORT(Aleft; n=2) 0 5 Aright =MERGESORT(Aright; n=2) 6 Merge the two halves into A0 7 return A0 The running time of the merge procedure is Θ(n). The overall running time (work) of the entire computation is W (n) = 2W (n=2) + Θ(n) = Θ(n lg n). 2 Let’s Make Mergesort Parallel The most obvious thing to do to make the merge sort algorithm parallel is to make the recursive calls in parallel. 1 MergeSort(A; n) 1 if n = 1 2 then return A 3 Divide A into two Aleft and Aright each of size n=2 0 4 Aleft spawn MERGESORT(Aleft; n=2) 0 5 Aright MERGESORT(Aright; n=2) 6 sync 7 Merge the two halves into A0 8 return A0 The work of the algorithm remains unchanged. What is the span? The recurrence is SMergeSort(n) = SMergeSort(n=2) + Smerge(n) Since we are merging the arrays sequentially, the span of the merge call is Θ(n) and the recurrence solves to SMergeSort(n) = Θ(n).
    [Show full text]
  • An Efficient Methodology to Sort Large Volume of Data
    INTERNATIONAL JOURNAL OF SCIENTIFIC & TECHNOLOGY RESEARCH VOLUME 9, ISSUE 03, MARCH 2020 ISSN 2277-8616 An Efficient Methodology to Sort Large Volume of Data S.Bharathiraja, G.Suganya, M.Premalatha, R.Kumar, Sakkaravarthi Ramanathan Abstract—Sorting is a basic data processing technique that is used in all day-day applications. To cope up with technological advancement and extensive increase in data acquisition and storage, Sorting requires improvement to minimize time taken for processing, response time and space required for processing. Various sorting techniques have been proposed by researchers but the applicability of those techniques for large volume of data is not assured. The main focus of this work is to propose a new sorting technique titled Neutral Sort, to reduce the time taken for sorting and decrease the response time for a large volume of data. Neutral Sort is designed as an enhancement to Merge Sort. The advantages and disadvantages of existing techniques in terms of their performance, efficiency and throughput are discussed and the comparative study shows that Neutral sort drastically reduces time taken for sorting and hence reduces the response time. Index Terms—Chunking, Banding, Sorting, Efficiency, Merge sort, Bigdata Sorting, Neutral Sort. —————————— —————————— 1 INTRODUCTION N data science, ordering of elements is very much useful in divided chunks may already be in sorted manner and hence I various applications and data base querying. Different doesn’t need further split, we have proposed a modified approaches have been proposed by researchers for Merge sort algorithm titled “Neutral sort” to reduce time performing the sorting operation effectively based on the type complexity and hence to reduce response time.
    [Show full text]
  • Parallel Techniques
    Algorithms and Applications Evaluating Algorithm Cost Processor-time product or cost of a computation can be defined as: Cost = execution time * total number of processors used Cost of a sequential computation simply its execution time, ts. Cost of a parallel computation is tp * n. Parallel execution time, tp, is given by ts/S(n). Cost-Optimal Parallel Algorithm One in which the cost to solve a problem on a multiprocessor is proportional to the cost (i.e., execution time) on a single processor system. Can be used to compare algorithms. Parallel Algorithm Time Complexity Can derive the time complexity of a parallel algorithm in a similar manner as for a sequential algorithm by counting the steps in the algorithm (worst case) . Following from the definition of cost-optimal algorithm But this does not take into account communication overhead. In textbook, calculated computation and communication separately. Sorting Algorithms - Potential Speedup O(nlogn) optimal for any sequential sorting algorithm without using special properties of the numbers. Best we can expect based upon a sequential sorting algorithm using n processors is Has been obtained but the constant hidden in the order notation extremely large. Also an algorithm exists for an n-processor hypercube using random operations. But, in general, a realistic O(logn) algorithm with n processors not be easy to achieve. Sorting Algorithms Reviewed Rank sort (to show that an non-optimal sequential algorithm may in fact be a good parallel algorithm) Compare and exchange operations (to show the effect of duplicated operations can lead to erroneous results) Bubble sort and odd-even transposition sort Two dimensional sorting - Shearsort (with use of transposition) Parallel Mergesort Parallel Quicksort Odd-even Mergesort Bitonic Mergesort Rank Sort The number of numbers that are smaller than each selected number is counted.
    [Show full text]