§ /prog/ Challenge #32767 §
1
Name:
Anonymous
2011-05-10 16:42
The Challenge : Given a number k where k ≥ 2, print another program (in the language you solve this challenge) that performs an O(nk ) sort on a list (in-place or not is for you to decide).
The Deadline : 2011/05/18, 00:00 UTC.
2
Name:
>>1
2011-05-10 16:44
Errata : s/this challenge/& in/
3
Name:
Anonymous
2011-05-10 16:45
That's not too hard really... so I'm not going to do it.
4
Name:
Anonymous
2011-05-10 17:38
>>1
print another program (in the language you solve this challenge)
Unfair for non-Lispers.
5
Name:
Anonymous
2011-05-10 18:13
The UTC
6
Name:
Anonymous
2011-05-10 19:49
Would it be a good idea to complete one of these nutty challenges (in Java) and use that for a job application that requires a code sample?
7
Name:
Anonymous
2011-05-10 21:45
let rec sortExprStr (k:int) (listExpr:string) =
if k = 2 then
"let rec qsort(xs : List<int>) =
match xs with
| [] -> []
| x :: xs ->
let smaller = qsort (xs |> List.filter(fun e -> e <= x))
let larger = qsort (xs |> List.filter(fun e -> e >= x))
smaller @ [x] @ larger
qsort %listExpr".Replace("%listExpr", listExpr)
else
let subSort = sortExprStr (k - 1) listExpr
"%listExpr |> List.fold (fun acc n -> begin %subSort end) []".Replace("%listExpr", listExpr).Replace("%subSort", subSort)
System.Console.WriteLine(sortExprStr 10 "[3; 2; 1]")
8
Name:
Anonymous
2011-05-10 21:56
>>7
<=
>=
Are you sure that it does work?
9
Name:
Anonymous
2011-05-10 22:04
MORE LIKE
DO YOUR OWN HOMEWORK, BOZO
AMIRITE LOLLLLLLLLLLLLLLLLLLLLLLLZzz!!11oNE!!1ONE1!
10
Name:
Anonymous
2011-05-10 22:13
>>8
Should be
<= and
> instead. I copied and pasted it from a web site without checking it over.
11
Name:
Anonymous
2013-01-19 22:17