Jump to content

Sorting algorithms/Patience sort: Difference between revisions

(Added 11l)
Line 16:
I arr.len < 2 {R}
 
[[IntT(arr[0])]] piles
L(el) arr
L(pile) piles
Line 40:
V iArr = [4, 65, 2, -31, 0, 99, 83, 782, 1]
patience_sort(&iArr)
print(iArr)</lang>
 
V cArr = [‘n’, ‘o’, ‘n’, ‘z’, ‘e’, ‘r’, ‘o’, ‘s’, ‘u’, ‘m’]
patience_sort(&cArr)
print(cArr)
 
V sArr = [‘dog’, ‘cow’, ‘cat’, ‘ape’, ‘ant’, ‘man’, ‘pig’, ‘ass’, ‘gnu’]
patience_sort(&sArr)
print(sArr)</lang>
 
{{out}}
<pre>
[-31, 0, 1, 2, 4, 65, 83, 99, 782]
[e, m, n, n, o, o, r, s, u, z]
[ant, ape, ass, cat, cow, dog, gnu, man, pig]
</pre>
 
1,481

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.