Sorting is the process of applying some order to a collection of items.

learn more… | top users | synonyms

5
votes
2answers
50 views

UniqueList Class in VBA

I often find myself abusing dictionary objects just for the exist method like this, ...
10
votes
2answers
261 views

Sorting an List of tiles based on size and row limitation

We are using the below code to optimally display our menu items (metro style). We are looping through an array of menu items and automatically shifting them based on size. Our tiles could be a size ...
5
votes
1answer
66 views

SortedSet of scored items

I want to return a set of items with an attached score to the user so that the user can easily iterate from highest to lowest and get the n-th highest items. Problems The JavaDoc of ...
0
votes
1answer
65 views

Reducing the sorting time of a large number of numbers

I have to sort many large numbers in a given time limit. The program below works, but not when the test cases reaches \$10^6\$, in which case it exceeds the time limit. ...
6
votes
2answers
49 views

External / File-based mergesort

I've implemented an external mergesort to sort a file consisting of Java int primitives, however it is horribly slow (fortunately it does at least work). Very little happens in the sort method: it ...
7
votes
2answers
257 views

Performing insertion sort in C#

This is my code in C# for performing insertion sort: ...
2
votes
4answers
564 views

Sorting Algorithms

A group of basic sorting algos. Based on Algorithms, 4th Edition - Robert Sedgewick | Kevine Wayne. Just making sure all of my logic and everything is correct. ...
8
votes
2answers
93 views

Sorting a collection

Related to, but not exactly a follow up of this question. After fixing some issues discovered in the last review, I added a little more functionality to the ...
3
votes
3answers
91 views

A practical example of evenly distributing n lists into a single list

I had previously asked about how to evenly distribute the items in n lists into a single list and was referred to this question. I made a practical example of my solution for this in VBA for Excel, ...
7
votes
1answer
81 views

Sorting Visualizations - WinForms

Description I think many many people have seen this youtube video "15 Sorting Algorithms in 6 Minutes" When I saw it, I decided: "I can do that better" and I tried to get things done with the tools ...
7
votes
2answers
86 views

Merge sort in JavaScript

I implemented this merge sort in JS and noticed that for random integer numbers it's a lot faster than the build in sort functions of all the browsers I tested (Chrome, FF, IE). Does anyone have an ...
5
votes
3answers
68 views

Merge Sort implementation in Java

Can you check my merge sort implementation? From all of my testing it seems like it works, but I just wanted to make sure I am doing it as good as possible, and it couldn't be optimized any further. ...
2
votes
3answers
80 views
0
votes
3answers
24 views

Determining if integers are sorted

I have this task to find whether 5 integers are ordered from the smallest to the largest or not. Depending on the results, the program output should be "yes" or "no". No loops or arrays supposed to ...
2
votes
4answers
88 views

Java sort by selection: which is better in regards to readability and efficiency?

Which algorithm do you think is better in regards to readability and efficiency? selection(): ...
7
votes
3answers
377 views

Ticket management system

I am building a ticket management system for a state server we use at work. Back end is node.js with multiple front ends. I am rewriting my back end to be more maintainable as the scope grows. For ...
2
votes
1answer
53 views

Insertion sorting an int array

I'd like to improve this Insertion sort code ...
7
votes
5answers
393 views

Checking if an array is sorted

I've come up with two ways to check to see if array is sorted and return true if it is. ...
4
votes
1answer
42 views

Potential quicksort optimizations

I implemented qsort() like this. I was wondering what improvements I could do to make it better. ...
0
votes
2answers
55 views

Selection sorting an int array

I'd like to improve this selection sort code ...
6
votes
3answers
721 views

Bubble sorting an int array

I'd like to improve this bubble sort code ...
3
votes
3answers
227 views

Can this insertion sort be optimized?

Could you provide feedback for this code? For arrays of length 2, is it more efficient not to use a sorting algorithm? ...
6
votes
3answers
104 views

Sorting three Decimal values

I have been given three values. @lLength, @lWidth, @lHeight. I need to take these ...
6
votes
4answers
200 views

Comparing pivot choosing methods in quicksort

I have seen various tweaks for quicksort and to establish their usefulness, I designed a program that randomly generates arrays and times how long quicksort takes to sort them. Right now I'm focusing ...
0
votes
1answer
39 views

Implementing a bubble sort on a linked list [closed]

I'm using the following prototype: Data* bubble_sort(Data *list); I'm trying to implement a bubble sort given a linked list of names. Note: this returns ...
-1
votes
3answers
114 views

Better sorting speed

import sys x=int(sys.stdin.readline()) lst = [int(sys.stdin.readline()) for i in xrange(x)] lst.sort() print lst How can I make this code faster for large ...
6
votes
3answers
275 views

Comparator based on Double values in Java

I have class point that represents point in 2D and I want to sort these points once based on their x-coordinate and second based on their y coordinate. Since x and y are double values my code looks ...
8
votes
2answers
390 views

Efficient way of sorting a List based on multiple properties using Google Guava

I'm using Google Guava 17.0 library. I have a class named AroundBust containing only two properties id of type ...
0
votes
0answers
43 views

Is my implementation of a merge sort correct?

I tried to get into programming several times but never did and never got very far past "Hello, World.", until recently when I found and read (most of, still don't get parts of it) "The Little ...
3
votes
2answers
71 views

Implementation of merge sort and bubble sort

I'm new to Go and looking for a review of my merge sort and bubble sort implementations. What can be done better? Can my code be cleaner/clearer? ...
2
votes
1answer
36 views

Search for data and order by priority efficiently

I have a search-function, that searches for specific data within a huge Object. Depending on how good a found entry matches, the finding gets "matchPoints" (or "Priority") ...
4
votes
1answer
56 views

Counting inversions

Inversion Count for an array indicates – how far (or close) the array is from being sorted. If array is already sorted then inversion count is 0. If array is sorted in reverse order that inversion ...
6
votes
2answers
160 views

Testing quicksort user input

I am testing a quicksort implementation. Arrays of random size with random data are passed to quicksort and the return time is averaged out. The user is prompted to enter values for minimum length ...
3
votes
1answer
46 views

Rebol Function to Categorize Items in a Block

I have a function that iterates through a block, tests each value against a given function and is placed in a block associated with the product of that function. ...
10
votes
3answers
734 views

Sorting numbers using Java Collections.sort()

Input is a file containing numbers in this format: 1.2 3 5.1 2 7 4 6 5 2 9.22 1 0.0 4 3 I am doing the sorting in the simplest way, using ...
7
votes
2answers
126 views

A Ruby sorting program for multiple criteria

This code review expands on an earlier one that deals with generating a football table from match data. This review deals with ordering said table based on several criteria. Your ...
6
votes
1answer
62 views

Algorithm for finding inversions in Merge Sort

Please help in code reviews for readability, optimizing it, functionality etc. ...
4
votes
1answer
58 views

Count array inversions merge sort

How does it look? Comments, code correctness, etc. ...
3
votes
2answers
64 views

Method for sorting numbers

I am new to jQuery and I want to know if there is a more efficient way to achieve this. I have an input with numbers 1, 2, 3, 4 and I want to change the order of this number dynamically according to ...
1
vote
0answers
48 views

Sort by value in multidimensional array

I have a multidimensional array of house properties: ...
4
votes
3answers
117 views

Sorting a flattened array

I'm using C# in .NET 4. The class holds an array of double that represents a 2-D rectangular matrix but (due to business requirements) must be stored flattened ...
3
votes
3answers
97 views

Merge Sorting in Python

This my implementation of the Merge Sorting Algorithm: ...
1
vote
2answers
92 views

Merge sort algorithm implementation using C++ (redux)

This is a follow up question to the one I asked a couple of days ago. I reviewed the suggestions & did some research (specifically, read relevant info on CLRS). The new version is 3 times ...
3
votes
3answers
83 views

Speed up counting sort algorithm in Ruby

I'm attempting this simple HackerRank counting sort problem but testcase #3, which has 100,000 test cases, is timing out. Is there something particularly inefficient about this code? ...
5
votes
2answers
325 views

Sorting an array in alphabetical order

I'm looking to get some feedback on this program I wrote - ways I could make it simpler or best practices methods. Chapter 7: Let's write a program which asks us to type in as many words as we ...
6
votes
2answers
850 views

Merge sort algorithm implementation using C++

I'm trying to learn proper C++ and algorithms at the same time. I particularly feel weird about my iterators usage in merge function. Is this a good way to handle ...
3
votes
2answers
67 views

How might we make this Python Merge Sort implementation more Pythonic?

I've implemented a (version of) Merge Sort algorithm in Python. My goal here is two-fold: Improve understanding of Merge Sort and recursion in a language agnostic way. Improve understanding of ...
2
votes
2answers
94 views
6
votes
2answers
546 views

Stable custom alphabetical order using List<T>.Sort

Background This is a problem from a programming contest. The Sharonians of planet Sharon, at the far end of our galaxy, have discovered various samples of English text from our electronic ...
1
vote
3answers
61 views

Activity by length

I was having a hard time finding out how to make this any faster. I broke down the code that I am playing with into more methods than necessary to try and see where things could increase. Can anyone ...