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

learn more… | top users | synonyms (1)

4
votes
1answer
30 views

Bubble Sort in C

I am trying to learn C coming from Python. Below is an implementation of bubble sort, slightly optimized. Any advice on best practices, readability, use of macros, and edge cases would be greatly ...
0
votes
0answers
17 views

What wrong with my HeapSort method? [on hold]

I've written a generic heap sort method, which passes in an array and a comparator variable. I can't find out the reason why it's not working. When I call the heapSort method from a simple driver i ...
1
vote
2answers
26 views

Re-sorting newsfeed based on date

Background: A client side I made recently has a component that is made from several (20+) rss-feeds, and the feeds are mashed into one using FreshRSS hosted on our servers. For some reason, FreshRSS ...
4
votes
1answer
71 views

Counting sort using STL

I'm trying to learn to use the C++ Standard Library and some of the modern C++11 features. Can someone review my counting sort algorithm below and critique my style/algorithm/use of the STL? Thank ...
4
votes
1answer
77 views

Sort algorithm in c

I wrote this algorithm a while ago, and decided to revisit it and polish it up. It basically works by comparing each number with all the other numbers once, so comparing the first number to all ...
2
votes
1answer
51 views

Clustering similar tweets in a corpus

I am attempting to write a statistical program using an LDA model I've trained/created using Gensim. I am very new to Python and am a student level programmer. This current program is working and ...
2
votes
2answers
52 views

Designing a sorting algorithm from scratch

I'm taking a Python course and the current assignment is to create an algorithm that sorts numbers in ascending order (without using built-in sorting functions). I've had no programming experience ...
2
votes
1answer
41 views

Optimizing quicksort partition method/function for duplicate elements

I'm a newbie and interested in learning different data structures and algorithms. While implementing quicksort, I found this code works pretty well for partitioning. ...
4
votes
0answers
42 views

Topological sort using recursive DFS

I am currently learning Graph algorithms by solving questions on online judges. The below code is for implementing Topological sort, using recursive DFS. Also, it is my first time with C++ STL. ...
1
vote
1answer
48 views

My implementation of counting sort [closed]

I've made the following implementation of counting sort. I don't think that I understand the algorithm fully but this implementation seems to be working correctly. I've used the ...
2
votes
0answers
21 views

Recursive bubble sort in OCaml

I'm new in OCaml and just want to be sure that I write code in "ocaml way". My other first programs in OCaml was imperative and looks like python-code. So I decided to write simple code and share it ...
6
votes
3answers
346 views

Sorting a String based on its words

Is there a better, more efficient or nicer way to do this? ...
2
votes
1answer
27 views

Python - insertion sort

Series post - I am reading through Introduction to Algorithms, 3rd Edition implementing each algorithm as I read them. Pretty basic insertion sort. Only considering numbers initially - how could I ...
7
votes
2answers
91 views

Bucket sort in Haskell

As a first step in learning Haskell I am solving this problem, which involves finding the Rith-ranked numbers, given some input list and many Ri. In an imperative language I would make a zeroed array ...
6
votes
2answers
79 views

Melsort — Sorting with encroaching lists

For the nth time already I come back with yet another alien sorting algorithm. Today I will present Melsort, implemented from the description I found in the paper Encroaching Lists as a Measure of ...
5
votes
1answer
98 views

C# Sorting array without using the bubble sort

I'm a beginner and like to experiment new things so today I tried to implement sorting method for an array without using any Sort and the actual challenge was to do ...
1
vote
1answer
89 views

UVA #10258 - Contest Scoreboard

The problem statement is here. Problem Description The task is to rank the contestants in the contest based on following criteria Contestants are ranked first by the number of problems solved (the ...
4
votes
1answer
79 views

Quicksort implementation in Java

I wrote this implementation of quicksort as a bit of practice and review for myself. I did not base my algorithm on anything more than my own understanding of quicksort and working through a couple ...
3
votes
3answers
61 views

Hackerrank Insertion Sort Part 2

I have started learning Java recently and was looking into the challenges on sorting on Hackerrank.I solved the following problemHackerrank on Insertion Sort. The challenge was : In Insertion ...
3
votes
1answer
70 views

Basic sorting in Python

Previously asked here. I would like to get my code for implementation of simple sorting algorithms in idiomatic python code reviewed. I am looking for feedback on python idioms used, better ways of ...
2
votes
1answer
72 views

Implementing basic sorting in Python

I would like to get my code for implementation of simple sorting algorithms in idiomatic python code reviewed. I am looking for feedback on python idioms used, better ways of doing the same thing. I ...
0
votes
2answers
77 views

Sorting List on basis of certain letter

I am trying to sort a list on basis of C before . Is there better way to do this? ...
5
votes
1answer
60 views

Sorting an array of time-specific tasks of varying importance

RULES: Strict tasks must occur at the time the user selected no matter what. Flex tasks are in a priority order. Even if there is a gap big enough to fit several flex tasks with lower priority, no ...
2
votes
0answers
53 views

Parallel merge sort in Java

I have rolled my own parallel merge sort. My performance figures are as follows: Seed: 1457521330571 java.util.Arrays.sort() in 6840 ms. Sorted: true java.util.Arrays.parallelSort() 3777 ms. ...
3
votes
2answers
42 views

SortedList implementation in Java

I've implemented a SortedList which takes in streams of floats and returns a median at any point. ...
2
votes
0answers
38 views

Sort Algorithms in Julia

Similar to this question here, I am trying to implement sort algorithms in Julia, as part of a package. The code for the implementation is as follows: ...
2
votes
0answers
21 views

Guidance on grouping equal sets of numbers, so each group has a similar average

Goal: I am trying to build teams of 5 people. Each person has an integer elo (rank). My goal is to make all the teams as equal/fair as possible, by having the average elo of each team be as close as ...
3
votes
3answers
60 views

generate word list based on Spanish text file

I'm a beginner and wrote a program takes a text file and writes a downcased vocabulary list to another text file. I intend to use it mainly to work with text in Spanish, so I added a line to downcase ...
3
votes
1answer
70 views

Faster QuickSort

I'm trying to make my QuickSort faster than it is and I have got no more ideas about how to make it more efficient for all types of arrays but mostly very big arrays. It uses random to create the ...
1
vote
1answer
42 views

Mapping and sorting lists of Haskell tuples

I'm a newbie with Haskell and I'm trying to learn the language and its idioms while working through a small data analysis project. The first step of my analysis is to take a very long list of data, ...
3
votes
2answers
83 views

Quicksort for a pseudosite

I have a pseudosite, where I actually post small functions, so that I can re-use them*, but some posts have visitors. The top is Quicksort (C++). I feel that beginners visit it, so I do not care in ...
3
votes
3answers
81 views

Sort stack in ascending order

I am using two more helper stacks to sort. Kindly suggest improvements in terms of space and time. ...
1
vote
1answer
75 views

MSD radix sort in C++

I have this MSD radix sort in C++: ...
11
votes
2answers
152 views

Forecast maintenance interval for fleet of aircraft

Being new to VBA, and many years removed from college programming courses in Java, I'm seeking opinions about design, implementation, readability and general better practices using VBA to tackle ...
3
votes
0answers
67 views

Integer tree sort in Java

I have this algorithm for sorting integer arrays. Basically, it's a balanced tree sort which creates a tree node for each distinct integer, and in each tree node it maintains a counter counting how ...
3
votes
0answers
28 views

Adaptive counting sort for integer arrays in Java - follow-up

I have refactored this. Once again, the running time can be anything between \$\Omega(n)\$ and \$\mathcal{O}(n^2)\$, yet it adapts to "smoothness" of the input array. ...
3
votes
1answer
46 views

Count the number of checks each method had to perform before fully sorting the array

So I'm writing a program that compares Bubble, Selection, Merge, and Quick Sort. All 4 methods are given a randomized array of 1000 elements and I count to see how many times it takes a method to ...
1
vote
1answer
101 views

Shell Sort Comparisons/Exchanges Counter

I need to analyze shell-sort. Currently I am working with it having an increment of N/2. I will then go on to try more efficient increments. However, my count for ...
0
votes
1answer
40 views

Creating indexes from a theoretical decimal/int, splitting into before and after arrays

I'm currently populating before and after arrays with indexes, based on a number provided. If the input going in is an int, ...
1
vote
1answer
51 views

Alphabetical Sort

I have the following first-letter only alphabetical sorting algorithm: Note: FileManager is just a file I/O class that reads in the unsorted words from a textfile ...
3
votes
2answers
82 views

Sort array of objects with hierarchy by hierarchy and name

I have an array of nested objects: ...
3
votes
3answers
103 views

Natural merge sort in C

I have this C implementation of the natural merge sort: ...
0
votes
2answers
70 views

Custom sorting function implemented as a jQuery plugin

I was asked to create a jQuery plugin that would sort homogeneous DOM elements in a given DOM container element. I came up with the idea to attach data-priority ...
4
votes
2answers
61 views

Vector Sort Function

I had heard about sorting for a while, but never actually gave it a try. So I decided to make an algorithm that would sort the members of a vector from least to greatest. Though this may seem pretty ...
1
vote
1answer
179 views

Random maths quiz with sorting

...
5
votes
3answers
147 views

Heapsort in Python

Please review the following in-place implementation of Heapsort in Python: ...
3
votes
2answers
110 views

Slow merge sort

...
4
votes
2answers
116 views

Sort a stack of numbers in ascending order only using push

I have a stack of numbers ranging from 1 to 1 million representing a pile of numbered DVDs. Given the stack in random order I am to sort the stack by only taking an element from the stack and push it ...
3
votes
4answers
113 views

C++ Interrupted Bubble Sort

I've written an interrupted bubble sort, which prints the intermediate result after some specified number of iterations of bubble sort. But I seem to have an speed issue. Could anyone help me spot ...
8
votes
3answers
508 views

Integer quicksort in Java

I have this Quicksort implementation that sorts arrays of int (not Integer). It has comparable performance to Java's ...