Questions tagged [sorting]

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

Filter by
Sorted by
Tagged with
8
votes
3answers
1k views

Quick Sort Implementation

I have written the below code for quick sort in Java: ...
8
votes
4answers
785 views

Quicksort in C++

Here is the implementation I ended up with. Please post your feedback! ...
6
votes
2answers
431 views

Sorted grep in Haskell

This program implements a sorted grep, that is, a specialized version of grep for sorted files. It uses binary search for the lines of a file that begin with a ...
4
votes
2answers
266 views

Optimizing error-sorting method

I just made this sort method. It runs fine and the code looks okay in my eyes. Is is possible to optimize it so it runs faster? If it's \$O(n^3)\$ now, it would be interesting changing it to \$O(n^2)...
15
votes
2answers
1k views

Is this C++ quicksort program okay?

I wrote a quicksort program in C++. Is it okay to implement it this way? Am I using pointers correctly? Is my style okay? Any ideas to speed it up or save memory? ...
7
votes
4answers
3k views

Heapsort is not modular

For the time being, I am not interested in any recursive solution. The code is not modularized; the whole body is inside the main function. ...
7
votes
3answers
42k views

Sorting algorithms implemented in C++

Implemented Bubble Sort, Insertion Sort, Selection Sort, Quick Sort, Merge Sort and Radix Sort https://code.google.com/p/medicine-cpp/source/browse/trunk/cpp/sorting/SortingAlgorithms.cpp ...
25
votes
5answers
78k views

Java Implementation of Quick Sort

This is my implementation of quicksort (algorithm taken from Cormen book). This is an in place implementation. Please let us know issues with this or any ideas to make it better. It performs at logN. ...
4
votes
4answers
708 views

My own quicksort algorithm

I will make it more reader friendly after I get the algorithm completed. Does anything with the quick sort algorithm stand out as for why it is not working 100%? This is not homework; I am just ...
4
votes
6answers
2k views

Listing books by priority

...
6
votes
3answers
534 views

Khan inspired Insertion Sort

I just watched a Khan Academy video on Insertion Sort and I've tried to write an implementation in Python. Please suggest corrections or improvements on this program: ...
8
votes
2answers
1k views

Using bucket sort to rank students based on their marks

Problem: n students have marks and names. Rank students based on their marks and print their names. ...
7
votes
1answer
715 views

Merge sort and selection sort comparison taking too long

I have this python code that compares merge sort and selection sort, but it is taking "forever." ...
9
votes
2answers
634 views

Insertion sort implementation adapted from the web

I've found this implementation on the web: ...
5
votes
3answers
924 views

Quicksort application

What do you think about this code? ...
37
votes
5answers
3k views

Sorting strings by length - functional Python

I'm trying to port this little F# snippet while staying pythonic: ...