All Questions
27 questions
1
vote
1
answer
118
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:
...
1
vote
1
answer
270
views
Find Kth Element in the merged two sorted arrays?
We have been given two sorted arrays and a number K . We have to merge the two sorted arrays in the sorted manner and return the element at the Kth position.
My approach is to use two variables ...
5
votes
1
answer
112
views
How to merge two descending singly linkedlist into one ascending linkedlist using Recursion without any helper method?
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 ...
1
vote
1
answer
67
views
What are the downsides of my Mergesort implementation?
Could I ask you to evaluate my implementation of mergesort?
I think that it's consistent with \$\mathcal{O}(n \log n)\$ complexity but has a downside that I create a new ...
1
vote
1
answer
1k
views
External polyphase merge sort
For comparison with other external sorting algorithms, I have implemented external polyphase merge sort, purported to be useful to sort large files that do not fit into main memory. More theoretical ...
2
votes
1
answer
146
views
Merge sort implementation with various improvements
So I was working on merge sort today, and was trying to speed it up. I would like your opinion on the implementation and if it's possible to make it faster. Besides that I was wondering if there are ...
3
votes
1
answer
623
views
Merge sort Java implementation for an interview
I just learned Merge sort, and I really like this Merge sort implementation since it is very logical and very easy to follow. If I was asked in an interview to implement merge sort, will this ...
5
votes
1
answer
1k
views
Multi-threaded in-place Mergesort on Java
What is an efficient way to implement the Mergesort algorithm in Java such that it meets the following criteria:
Must be multi-threaded.
Must retain the Mergesort time complexities.
Must be in-place ...
2
votes
1
answer
201
views
Adaptive Mergesort in Java - follow-up
(See the previous and first iteration.)
Adaptive Mergesort
This algorithm is from a paper "Sublinear Merging and Natural Mergesort" by Svante Carlsson, Christos Levcopoulos and Ola Petersson. It ...
3
votes
1
answer
397
views
Adaptive Mergesort in Java
(See the next iteration.)
This natural merge sort here is from "Sublinear Merging and Natural Mergesort" by Svante Carlsson, Christos Levcopoulos and Ola Petersson. The funky part is that it may ...
1
vote
3
answers
162
views
Merge Sort Java
This is the merge part of my solution. Method merge merges two already sorted lists. I feel the code I wrote isn't the best implementation. Please review the code ...
1
vote
2
answers
823
views
Merging K Sorted Arrays
My aim is to merge k different sorted array with unique elements and I want a code review about it, here is my code below which is written in java;
...
4
votes
2
answers
213
views
Merge sorting a singly-linked list in Java - follow-up
In this iteration, I incorporated all but one points made by forsvarir in the previous iteration. Now my code looks like this:
LinkedListNode.java:
...
3
votes
2
answers
746
views
Merge sorting a singly-linked list in Java
I have this nifty merge sort implementation for sorting singly-linked lists. Its running time is \$\Theta(n \log n)\$, yet it uses only \$\Theta(\log n)\$ space (the stack). See what I have below.
...
1
vote
1
answer
161
views
Mergesorting a stack in Java
(See the next iteration.)
I have this small program for sorting a stack using mergesort. Basically, the aim was to use as little aid from JDK library as possible. See what I have:
StackMergesort....