All Questions
Tagged with code-challenge sorting
19 questions
1
vote
1
answer
273
views
Implement the slowest possible sorting algorithm that retains a fast best case [closed]
I have recently been on a quest to create really really slow sorting algorithms that make Bogosort seem like it is the best.
The task is simple: Sort an array of integers in as long average time as ...
34
votes
9
answers
5k
views
A "Sorting" algorithm
There is a "sorting algorithm" sometimes called Stalin sort in which in order to sort a list you simply remove elements from the list until it is sorted in increasing order. For example the list
<...
18
votes
7
answers
2k
views
Blind Random Sort
Here's a pretty common pattern for sorting algorithms:
...
18
votes
2
answers
10k
views
Rubik-sorting a matrix (a.k.a. the torus puzzle)
The idea for this code-challenge is simple: given a matrix of integers, let's sort it by applying Rubik-style movements. This means that you can select a single row or column and rotate its elements ...
4
votes
1
answer
380
views
Pair and sort from two integer lists
You are given two arbitrary integer lists, e.g. [-10, 99, -6, 43], [100, 32, 44]. You are to pick one integer from each list and ...
32
votes
16
answers
3k
views
This is the sort of challenge that bytes
I need to stop thinking of punny names
Your task is to create as many snippets (programs that have input and output built-in), functions or full programs as possible that sorts whatever your language'...
8
votes
4
answers
782
views
Sort a list of unknown values with the least amount of comparisons
In this optimization challenge you will write a program that sorts a single array by only comparing elements through asking the user on stdout to input comparison results on stdin.
The below protocol ...
9
votes
1
answer
370
views
Sort scrambled two-dimensional array filled with numbers by swapping adjacent numbers [closed]
A two-dimensional array of size n×n is filled with n*n numbers, starting from number 1. Those numbers are to be sorted per row in ascending order; the first number of a row must be greater than the ...
20
votes
5
answers
8k
views
Sort a List With Swaps and Pops
Consider a randomized list of the integers 1 to N. You want to sort it using only the following actions:
Swap the first and last list elements. (S)
Pop off the first element and append it to the end ...
11
votes
3
answers
807
views
Sort some apples!
Problem
Imagine 7 buckets lined up in a row. Each bucket can contain at most 2 apples.
There are 13 apples labeled 1 through 13. They are distributed among the 7
buckets. For example,
...
5
votes
0
answers
127
views
Using dictionaries, thesauruses, and similar databases, construct as large of a "See also" loop as possible [closed]
As I'm sure many of you know, synonyms can range from very similar to not-so-similar-but-I-can-see-how-it's-similar. It's common for dictionaries to use "See also" to denote occurrences of words that ...
21
votes
6
answers
5k
views
Tower of Hanoi Sort
Write a function/subroutine to sort a list of integers, Tower of Hanoi style.
You will be given a stack of integers. This is the main stack.
You are also given two more helper stacks. These helper ...
21
votes
29
answers
5k
views
Sort-a-number. Sorta [closed]
Inspired by the ill-fated sorting-a-numbers-digits-without-using-an-array, but I thought it made a better code golf than SO question.
Given a positive integer, sort the digits in that integer.
...
11
votes
14
answers
2k
views
Golfed+Fast sorting in C
[Latest update: benchmark program and preliminary resuls available, see below]
So I want to test the speed/complexity tradeoff with a classic application: sorting.
Write an ANSI C function that ...
4
votes
2
answers
461
views
Pseudosort a list in 2*n comparisons
Write a program that takes a list of n space-separated integers, and outputs a permutation of that list using a maximum of 2*n comparisons.
It should loop this until an empty line is input. ...