Skip to main content

Questions tagged [mergesort]

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

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
4 votes
3 answers
1k views

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 ...
rcgldr's user avatar
  • 376
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
2 votes
1 answer
93 views

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 ...
Preatorius's user avatar
1 vote
1 answer
130 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.3k
12 votes
4 answers
2k views

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, ...
user14464173's user avatar
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
0 answers
139 views

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 ...
bfair's user avatar
  • 131
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
2 votes
3 answers
573 views

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 ...
Oliver Schönrock's user avatar
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
3 votes
1 answer
162 views

I just started Stanford Coursera algorithms course and I wrote this mergesort based on what was shown: ...
Aayush's user avatar
  • 61
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
3 votes
1 answer
116 views

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 ...
Turing85's user avatar
  • 137
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

15 30 50 per page
1
2 3 4 5
20