3 ms·
Algorithm 1 ICan’tBelieveItCanSort(A[1..n]) for i = 1 to n do for j = 1 to n do if A[i] < A[j] then swap A[i] and A[j]
by berbec 2y ago
Algorithm 1 ICan’tBelieveItCanSort(A[1..n])
for i = 1 to n do
for j = 1 to n do
if A[i] < A[j] then
swap A[i] and A[j]
- dang 2y agoFor code formatting, you can prepend two spaces to a line (this is in https://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc). (That's what ColinWright did at https://news.ycombinator.com/item?id=43162234 https://news.ycombinator.com/item?id=43162234 for example.)