All Questions
55 questions
34
votes
15
answers
2k
views
In what order will the downloads complete?
Background
Recently, I was installing updates on my pc with Pacman (I use arch btw) and noticed the order it downloaded files was like this
Start with the largest 4 downloads
When a download ...
15
votes
17
answers
2k
views
How long to carry sort?
Carry sort is an \$O(n)\$ "sorting" algorithm. Here's how it works. The algorithm moves left to right along a list. As it traverses a list it "carries" a single item, the largest ...
14
votes
8
answers
2k
views
Change the subject
Sometimes I feel like the conversation is going down the wrong path and take it upon myself to steer it in another direction. And this conversation is going wrong real fast, so I need to change the ...
21
votes
14
answers
2k
views
Sort numbers in a ragged list
Given a ragged list, e.g.
[[4, 7], [5, 3, [], [6, [2]]]]
Your challenge is to sort only the numbers in it. For example, with the above, the result would be
...
10
votes
9
answers
554
views
Sort musical pitches
Given an unordered list of musical pitches, write the shortest program/function (scored in bytes) to sort the list from lowest pitch to highest.
Pitches will be given in scientific pitch notation, ...
18
votes
17
answers
2k
views
Sort every dimension
Given a multidimensional, rectangular array of nonnegative integers, sort it at every depth (lexicographically), starting from the innermost.
For example, with this array:
...
28
votes
30
answers
3k
views
Unsort an array
Inspired by this StackOverflow post
Given a list where each element appears a maximum of 2 times, we can define it's "sortedness" as the sum of the distances between equal elements. For ...
17
votes
25
answers
2k
views
Chunk Sort a Sequence
Your task is to input a sequence of integers and chunk sort it. You may assume the input list can always be chunked into groups of 1, 2, and 3.
Definition
Chunk sorting (a term I made up for the ...
42
votes
17
answers
5k
views
Recursive Stalin Sort [duplicate]
There is a "sorting" algorithm often called Stalin Sort, where instead of sorting an array, you just remove any items that are out of order. In this challenge, you'll implement part of a ...
8
votes
7
answers
271
views
Dropsort with a Twist
This is my first attempt at a Code Golf question. If it needs obvious edits, please feel free to make them.
Below is a description of the basic Dropsort algorithm.
Dropsort is run on a list of ...
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 ...
15
votes
22
answers
3k
views
Block-sorting rows and columns in a 2D array
Given a 2D array of integers, let's sort its rows and columns in blocks. This means that you only have to sort a given row or column, but applying the transformations needed for sorting it to every ...
10
votes
8
answers
597
views
Codegolf Rainbow : Sorting Colors with Reflection
Introduction:
After I posted two rainbow-related challenges: Codegolf Rainbow : Fun with Integer-Arrays 1 and Codegolf Rainbow : Draw in Black-and-White 2, the following comment was made by @ChrisM in ...
5
votes
4
answers
506
views
Einstein's Sorter
Challenge
Given a list of integers and a velocity, \$v\$, implement a sorting algorithm which simulates a program sorting the list from smallest to biggest at the given velocity.
Einstein's Theory ...
25
votes
65
answers
6k
views
Sort odd numbers first
Rearrange a given list such that all the odd numbers appear before all the even numbers. Besides for this requirement, the output list may be in any order.
The input will only contain integers, but ...