Skip to main content

Questions tagged [mergesort]

For code that implements a merge sort or a significant part of it

Filter by
Sorted by
Tagged with
2 votes
1 answer
100 views

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: ...
Akash Gupta's user avatar
1 vote
3 answers
134 views

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 ...
Voiceroy's user avatar
  • 113
1 vote
1 answer
129 views

Here is the code for queue-mergesort by Mordecai J. Golin and Robert Sedgewick: com.github.coderodde.util.QueueMergesort.java: ...
coderodde's user avatar
  • 32.2k
2 votes
1 answer
86 views

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 ...
Thomas Mathew's user avatar
3 votes
2 answers
269 views

I wrote a merge sort implementation in C++ today in C++20 way. ...
frozenca's user avatar
  • 1,751
9 votes
3 answers
1k views

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 ...
nickhealy's user avatar
  • 165
1 vote
2 answers
193 views

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; ...
Krokodil's user avatar
  • 123
1 vote
2 answers
126 views

I have recently learned Merge Sort algorithm in C++ with 2 ways of writing it. 1st Way: ...
DivijM's user avatar
  • 111
2 votes
3 answers
620 views

We wrote a code that parallelizes the divide phase of the mergesort algorithm. I.e. every recursive call is assigned to a thread but our teacher was disappointed because he said we should also ...
New2Math's user avatar
  • 121
5 votes
1 answer
119 views

I am using this merge sort function to sort table rows by Date, Letter, and Number. It works, but it is super messy and hard for others to read. The dates are being sorted in two formats YYYY-MM-DD ...
Gunnarhawk's user avatar
2 votes
2 answers
142 views

I previously implemented a Merge Sort for arrays, so after fixing up my code for the array-based merge sort I have now implemented a merge sort for a basic singly-linked list data structure which only ...
CLox's user avatar
  • 419
2 votes
3 answers
496 views

This is my version of mergesort. ...
theProgrammer's user avatar
4 votes
1 answer
3k views

Explanation: Although merge sort runs in Ω(nlgn) and insertion sort runs in Ω(n^2), the constant factors in insertion sort can make it faster in implementation for small problem sizes. This sorting ...
erwoods89's user avatar
3 votes
1 answer
158 views

My mergesort implementation currently takes a very long time, for a list with 1 million elements it takes over 130 seconds to get the list sorted. Could someone kindly have a look at my code and ...
Nishil Patel's user avatar
3 votes
2 answers
167 views

I'll try to publish a paper about the programming language I've made (ArithmeticExpressionCompiler, short AEC) in Osječki Matematički List and, in order to demonstrate its usability for implementing ...
FlatAssembler's user avatar
5 votes
1 answer
124 views

Here is my solution: I want to know if my solution fits the requirement 100%? Or if there is any better solution? Constraint of the question: must be singly linkedlist must use recursion, and no ...
Ziyu Zhong's user avatar
4 votes
1 answer
192 views

I'm reading "Introduction to Algorithms" by CLRS and I can't find an implementation of the pseudo code from the book in golang. By the original implementation I mean that we deal with extra parameters ...
maxim-glyzin's user avatar
2 votes
1 answer
70 views

I would be especially happy to hear opinions about complement_union. The rest of the code is just there to test the output. ...
mcocdawc's user avatar
  • 974
2 votes
1 answer
411 views

I've tried to implement parallel MergeSort in C++, that also tracks how many comparisons it's made and how many threads it uses: ...
FlatAssembler's user avatar
4 votes
0 answers
307 views

I'm in the process of learning both Rust and algorithms after primarily focusing on web development. As such I've had a go at implementing merge sort both iteratively and recursively. I've looked for ...
Naaman's user avatar
  • 71
6 votes
5 answers
515 views

This is follow up question regarding merge-sort implementation to the previous post. Recently I have implemented a command-line argument based merge-sort sorting algorithm. Format for command-line-...
strikersps's user avatar
3 votes
2 answers
182 views

I have implemented a Merge sort in Python 3, and it works well. If anything needs to be improved, I would appreciate the criticism. ...
Brijesh Kalkani's user avatar
3 votes
1 answer
498 views

Merge Sort Merge Sort algorithm is a general-purpose comparison-based sorting algorithm. Most implementations produce a stable sort, in which the order of equal elements is preserved. Here, our ...
Emma Marcier's user avatar
  • 3,742
1 vote
2 answers
187 views

I hava a question similiar with mege in Python but I am trying to write Java code. Here is my code: The input is: The first line - a number of arrays (k); Each next line - the first number is the ...
A user's user avatar
  • 53
5 votes
4 answers
606 views

I implemented the following mergesort algorithm in JavaScript, but I want to know your opinion about if is possible to do better than this. ...
Es-Loop's user avatar
  • 71

1
2 3 4 5 6