Questions tagged [mergesort]
For code that implements a merge sort or a significant part of it
                296 questions
            
            
            
                2
            
            votes
        
        
            
                1
            
            answer
        
        
            
                99
            
            views
        
        
            
            
        Multithreaded Merge Sort Using ForkJoin Framework
                    I've implemented a multithreaded merge sort using Java's ForkJoin framework, and I wanted to gather feedback on its correctness, efficiency, and scalability.
Here's my implementation:
...
                
            
       
        
            
                4
            
            votes
        
        
            
                3
            
            answers
        
        
            
                1k
            
            views
        
        
            
            
            
        Java class subset of C++ std::list with efficient std::list::sort()
                    Issues with generics < E > and < E extends Comparable > in code below. What changes are needed in the code below to prevent DLList.push_front() and DLList.push_back() from accepting ...
                
            
       
        
            
                1
            
            vote
        
        
            
                3
            
            answers
        
        
            
                131
            
            views
        
        
            
            
            
        another Merge Sort
                    I've tried to implement merge sort in c with varying degrees of success, one was correctly sorting the array but leaking memory, one was neither sorting the array and leaking memory.
The following was ...
                
            
       
        
            
                2
            
            votes
        
        
            
                1
            
            answer
        
        
            
                90
            
            views
        
        
            
        Implementing an improved merge sort that uses insertion sort, with "levels" - Would this work correctly?
                    We were asked to improve the merge sort algorithm by introducing insertion sort to the code. We have been tasked with doing this by utilising a "levels" logic. Here is the exact description ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                128
            
            views
        
        
            
            
        Queue-mergesort: a mergesort that does optimal number of comparisons in the worst case in Java
                    Here is the code for queue-mergesort by Mordecai J. Golin and Robert Sedgewick:
com.github.coderodde.util.QueueMergesort.java:
...
                
            
       
        
            
                12
            
            votes
        
        
            
                4
            
            answers
        
        
            
                2k
            
            views
        
        
            
            
            
        Recursive merge sort in C
                    Here's my first program in C, which is not my first language.
I have been reading Modern C and I attempted this challenge on page 26. The prior pages are pretty much the only exposure I have had to C, ...
                
            
       
        
            
                2
            
            votes
        
        
            
                1
            
            answer
        
        
            
                83
            
            views
        
        
            
            
            
        Merge Sort with Minimum Sufficient Variables, Verbosity and better Space Complexity
                    The majority of merge sort implementations searched online are provided with unnecessary variables and code lines. Here is an attempt to reduce that.  However, does passing back the subArray as return ...
                
            
       
        
            
                3
            
            votes
        
        
            
                0
            
            answers
        
        
            
                137
            
            views
        
        
            
            
        Destructive quick and merge sort
                    I've implemented a destructive merge and quick sort in common lisp, but the code feels verbose and highly imperative.  I was wondering if anyone could offer guidance on idioms that could make the code ...
                
            
       
        
            
                3
            
            votes
        
        
            
                2
            
            answers
        
        
            
                269
            
            views
        
        
            
            
            
        C++ merge sort, logging, unit test, performance check
                    I wrote a merge sort implementation in C++ today in C++20 way.
...
                
            
       
        
            
                2
            
            votes
        
        
            
                3
            
            answers
        
        
            
                561
            
            views
        
        
            
            
            
        Adjusting heaps efficiently
                    Introduction and context
I am working on a small application which involves sorting 20GB files as one of the operations. This is being done, due to memory constraints, by breaking them into ~1GB ...
                
            
       
        
            
                9
            
            votes
        
        
            
                3
            
            answers
        
        
            
                1k
            
            views
        
        
            
            
            
        C++ merge sort implementation (looking for advice)
                    I am trying to practice C++, so I decided to implement canonical algorithms in C++ as a way to learn best practices and idioms of the language.
I started with merge sort. How could I improve this ...
                
            
       
        
            
                3
            
            votes
        
        
            
                1
            
            answer
        
        
            
                161
            
            views
        
        
            
            
            
        Optimize mergesort algorithm
                    I just started Stanford Coursera algorithms course and I wrote this mergesort based on what was shown:
...
                
            
       
        
            
                1
            
            vote
        
        
            
                2
            
            answers
        
        
            
                187
            
            views
        
        
            
            
        Bottom-up merge sort
                    I think I programmed a bottom-up merge sort, but I'm a little sceptical that it will work under any data set. By now, I've tested it with many random arrays of massive lengths, and it seems to work; ...
                
            
       
        
            
                3
            
            votes
        
        
            
                1
            
            answer
        
        
            
                108
            
            views
        
        
            
            
        IOSP Kata: merge two sorted arrays without iterators
                    I wrote the code below as a Kata to practice the Integration Operation Segregation Principle (IOSP, clean-code-developers.com). I would like to have some feedback ...
                
            
       
        
            
                1
            
            vote
        
        
            
                2
            
            answers
        
        
            
                124
            
            views
        
        
            
            
            
        Comparison of 2 different ways of writing Merge Sort Algorithm
                    I have recently learned Merge Sort algorithm in C++ with 2 ways of writing it.
1st Way:
...
                
            
       
         
         
         
         
         
         
        