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

learn more… | top users | synonyms

8
votes
2answers
51 views

Quicksort in Python

This is my first actual attempt at writing a Python program. I have a background in C++, so it was a big change (where's my iterators?), and I'm looking for criticism on my use of Python and its ...
2
votes
1answer
42 views

Binary HeapSort and Ternary HeapSort implementation

This is my take on binary and ternary heapsort implementation for a university assignment. The code works but I wonder if there are any mistakes or things to improve. ...
1
vote
1answer
34 views

HeapSort Efficiency

For heap (array based) sort, we need to start at index 1, ignoring the 0th index. If I want to make a static function like ...
2
votes
1answer
39 views

Sorting an int[] array using insertion sort algorithm - follow-up

Previous questions: Is my implementation of insertion sort is correct? Sorting an int[] array with an Insertion Sort I'm currently learning about different sorting algorithms and after reading on ...
1
vote
3answers
357 views

Faster way to check for a string in a array of string

I have a array of object, I need to sort them by time (hours, days or months) and separate the number of new IP. result is an array of object with property time (JavaScript timestamp), user IP ...
5
votes
1answer
50 views

Sorting an int[] array with an Insertion Sort

I'm currently learning about different sorting algorithms and after reading on the concept of the insertion sort of how it's done I've tried to implement it by myself before seeing how it was ...
2
votes
1answer
40 views

Is my implementation of insertion sort is correct? [closed]

I'm currently learning about different sorting algorithms and after reading on the concept of the insertion sort of how it's done I've tried to implement it by myself before seeing how it was ...
3
votes
2answers
64 views

Merge sorting linked lists

This works as expected and I want to get this code reviewed so that I can improve my coding ability. I am concerned about readability and the quality of the code ...
2
votes
2answers
56 views

Comparing two bubble sort algorithms

I'm learning C and I've got to a point learning about different sorting algorithms. Before seeing how it was done, I wanted to try doing it myself based on what I read on how it's working. ...
5
votes
3answers
65 views

Bubble sorting in C

I've been into algorithms lately, so I wanted to apply a simple algorithm using a language of my choice, which was C in this case. I've implemented the bubblesort algorithm (for strings) in a simple ...
4
votes
3answers
114 views

Merge Sort Implementation in Java (that seems slow…)

I decided to write my own implementation of merge sort. Here is the code: ...
5
votes
2answers
66 views

UniqueList Class in VBA

I often find myself abusing dictionary objects just for the exist method like this, ...
10
votes
2answers
266 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
69 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
68 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. ...
7
votes
2answers
58 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
267 views

Performing insertion sort in C#

This is my code in C# for performing insertion sort: ...
2
votes
4answers
588 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
97 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
103 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, ...
8
votes
1answer
92 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
91 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
73 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
83 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
92 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
390 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
54 views

Insertion sorting an int array

I'd like to improve this Insertion sort code ...
7
votes
5answers
401 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
45 views

Potential quicksort optimizations

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

Selection sorting an int array

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

Bubble sorting an int array

I'd like to improve this bubble sort code ...
3
votes
3answers
229 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
106 views

Sorting three Decimal values

I have been given three values. @lLength, @lWidth, @lHeight. I need to take these ...
6
votes
4answers
212 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
48 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
117 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
289 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
448 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
45 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
77 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
38 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
117 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
170 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
56 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
925 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
132 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
71 views

Algorithm for finding inversions in Merge Sort

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

Count array inversions merge sort

How does it look? Comments, code correctness, etc. ...
3
votes
2answers
67 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 ...