Merge sort is an O(n log n) comparison-based sorting algorithm.

learn more… | top users | synonyms

5
votes
2answers
58 views

Racing Java Arrays.sort with NON recursive Merge Sort implementation

I found a bit better implementation for Java Arrays.sort(int[]). To make this code review more simple I divide this questions to several parts. The goal of this ...
6
votes
2answers
65 views

Generic Multiway Merge

Recently I had a problem (not in C++) that required merging a number of sorted lists of values. This is effectively the generalised case of merging together two sorted lists. However, instead of ...
6
votes
1answer
87 views

Merge sort could work 10 times faster

I am implementing merge sort in Java and I have a performance problem in this method: ...
7
votes
4answers
155 views

MergeSort performance

Do you see any inefficient parts with the following code? On internet I see 30 ms for 100.000 integers but I can sort 100.000 integers in 300ms. The data is random. I am using late 2013 macbook pro so ...
3
votes
1answer
67 views

Is there anything to improve in this MergeSort code in Java?

I have written an implementation of the merge sort algorithm in Java. Here is the MergeSort class that I created. ...
5
votes
1answer
96 views
7
votes
2answers
195 views

Is this non-recursive mergesort efficient and a good way to simulate the recursive version?

My teacher assigned us to do the recursive version of mergesort, yet I heard that the non-recursive version (bottom up) is a bit tougher, so I decided to this one as well. My main concerns are: ...
4
votes
1answer
70 views

Is this an efficient merge sort implementation with regards to average time complexity in Big-O notation?

Is my below merge sort implementation in O(n log n)? I am trying to implement a solution to find k-th largest element in a given integer list with duplicates with O(N*log(N)) average time complexity ...
1
vote
1answer
87 views

MergeSort F# Program

I have written the following program to implement merge sort in F#. Can you please review this and let me know how can I write this in the most functional way (also most efficient and concise)? In ...
4
votes
2answers
187 views

Merge two sorted arrays together

Please review my answer for this interview question: ...
0
votes
1answer
136 views

MergeSort implementation with java.util.List passed as argument, not returned

I'm working on an implementation of MergeSort which sorts a List given as an argument. As follows ...
2
votes
1answer
6k views

Merge Sort in C++

I've written this code for a merge sort, which is meant to implement the pseudo-code from Cormen's "Introduction to Algorithms": ...
2
votes
2answers
277 views

Merge Sort Implementation

Any reviews/ways to speed up/general improvements for my Merge Sort? Maybe something to simplify it or add more to it? ...
1
vote
1answer
1k views

Merge sort with a linked list

I'd like this code reviewed. ...
3
votes
1answer
101 views

Recursive Implementation of merge sort

Information about my code: I am following this MIT OCW algorithms course. The first lecture described insertion sort and merge sort. I implemented merge sort in C. The algorithm is structured as a ...
5
votes
2answers
212 views

What mistakes am I making with this Haskell implementation of merge sort?

I've decided to learn Haskell by following the current Coursera algorithms course using Haskell to implement the algorithms discussed. First up is merge sort, which I've implemented as shown here. ...
1
vote
1answer
151 views

Help Debug Merge Sort and validate comparison counters

All at the suggestion of templatetypedef (Thanks for your tips by the way), I am posting the code for my Merge Sort to see if I can get folks offer suggestions as to where to make comparisons or if I ...
3
votes
2answers
301 views
6
votes
3answers
803 views

Merge sort in scala

I've implemented merge sort in scala: ...
4
votes
2answers
317 views

ANSI C Mergesort - Pedantic criticism please

This is a mergesort implementation I wrote, trying to get back into C. I am not so much interested in feedback on the optimality of the algorithm (as I could read up countless articles i'm sure), but ...
7
votes
3answers
252 views

Is this attempt at a merge sort correct?

I am trying to write a merge sort algorithm. I can't tell if this is actually a canonical merge sort. If I knew how to calculate the runtime I would give that a go. Does anyone have any pointers? ...
1
vote
1answer
379 views

Am I doing this right? Merging 2 ordered source arrays into one destination array

My instructions were: Add a merge() method to the OrdArray class in the orderedArray.java program (Listing 2.4) so that you can merge two ordered source arrays into an ordered destination ...
5
votes
2answers
3k views
5
votes
0answers
548 views

Merge sort in Scheme

...
1
vote
0answers
160 views

F# mergesort code : where to improve

I would appreciate some quick comments on this basic mergesort code. Am I missing a big block in the langage? ...
4
votes
2answers
918 views

How to do Merge sort on Integer class in Java?

This is a specific case in merge sort. I'm trying to do a merge sort on an array that's created using the java Integer class. My implementation is slow and therefore needs some modifications for ...
10
votes
2answers
2k views

Parallel Merge Sort

Parallism is achieved by using a simple call to tbb::parallel_invoke(). However I can't break a speedup factor of x2 (after ~3-4 parallel HW threads), although 8 ...