initial commit.
This commit is contained in:
commit
d65c3211d0
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
build/
|
||||||
37
README.md
Normal file
37
README.md
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
# 🐌 snail-sort
|
||||||
|
|
||||||
|
Implementations in various languages for the snail sorting
|
||||||
|
algorithm, sorting an `n`x`m` rectangular, 2d array by
|
||||||
|
traversing elements in a clockwise spiral.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
Snail-sorting a `3`x`3` array:
|
||||||
|
|
||||||
|
```
|
||||||
|
[
|
||||||
|
[1, 2, 3],
|
||||||
|
[4, 5, 6],
|
||||||
|
[7, 8, 9],
|
||||||
|
]
|
||||||
|
|
||||||
|
=> [1, 2, 3, 6, 9, 8, 7, 4, 5]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Snail-sorting a `4`x`5` array:
|
||||||
|
|
||||||
|
```
|
||||||
|
[
|
||||||
|
[a, b, c, d, e],
|
||||||
|
[f, g, h, i, j],
|
||||||
|
[k, l, m, n, o],
|
||||||
|
[p, q, r, s, t]
|
||||||
|
]
|
||||||
|
|
||||||
|
=> [a, b, c, d, e, j, o, t, s, r, q, p, k, f, g, h, i, n, m, l]
|
||||||
|
```
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user