All Questions
320 questions
-4
votes
1
answer
105
views
Pyramidal (Heap) sorting by D. Knuth
Help me with Pyramidal sorting by D. Knuth algorithm in C++.
I would like to clarify if I followed the algorithm correctly.
The code works.
I have the function, but I'm not sure if my code fully ...
4
votes
1
answer
136
views
Efficient least-significant digit (LSD) radix sort for int keys in Java
(This post has a continuation post.)
This one is my attempt at LSD radix sort:
Code
com.github.coderodde.util.LSDRadixsort.java:
...
5
votes
1
answer
146
views
Sorting songs with the ability to save and resume partial sorts
I listen to a lot of music (~4k h/y) and managing thousands of songs is a bit of a challenging.
To improve my listening experience I want to better organize my collection.
One thing I want to do is ...
4
votes
1
answer
323
views
c++ quicksort pivots
Is this code for quicksort using the first index as a pivot correct?
Also if I want to use the last or middle index as a pivot how would the whole code change?
...
8
votes
2
answers
423
views
Heap sort optimization
I tried to optimize heap sort algorithm. Instead of recursion, I used iteration:
...
3
votes
1
answer
90
views
Creating Worst-Case Scenario for QuickSort using Middle Pivot in Java
I've implemented a solution to generate the worst-case scenario for QuickSort using the middle pivot strategy in Java. The goal is to rearrange an input array to produce the worst performance during ...
3
votes
2
answers
221
views
Counting duplicate elements in two sorted arrays
I've been working on an assignment that involves optimizing a duplicate finding algorithm for sorted arrays, and I'd like to get your thoughts on the implementation. Here's the code I've come up with:
...
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
161
views
K-Way Partitioning QuickSort
I have implemented the K-Way Partitioning algorithm which is based on the Peter Taylor's solution.
Which works but i want fill the q array which is the borders of ...
6
votes
2
answers
322
views
A selection sort implemented in Python
I'm not proficient at Python. My question is twofold: whether this selection sort algorithm implementation for number lists could be considered clean code (in the sense of being modular and ...
2
votes
1
answer
360
views
Sorting visualizer using Java Swing
I programmed a little sorting visualizer a while back and I have been meaning to get some feedback on the overall implementation and on what I could do better to have cleaner code or a "best ...
3
votes
3
answers
825
views
Sort array of associative arrays by the key of the subarrays
I am trying to sort an array of associative arrays in reverse order by the key of the subarrays.
I solved it with a bubble sort algorithm which worked just fine in my test.
I was wondering if there is ...
6
votes
3
answers
147
views
Simple selection_sort in C
I study algorithms, and I try to implement each algorithm in C
(Perhaps it would be better to choose C++, but okay)
Here is my implementation of sorting by choice. How would you rate it?
To be honest, ...
2
votes
2
answers
305
views
Bogo Sort Algorithm
I am a beginner programmer and have written a program that sorts a number of integers of your choosing using bogo sort.
Are there any improvements that could be made to make this code more efficient (...
0
votes
1
answer
297
views
bubble sort algorithm with nested loops performs better than with one loop JS
Here are 2 bubble sort algorithms:
1:
...