Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
20
Task/Sort-stability/Nim/sort-stability.nim
Normal file
20
Task/Sort-stability/Nim/sort-stability.nim
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import algorithm
|
||||
|
||||
const Records = [(country: "UK", city: "London"),
|
||||
(country: "US", city: "New York"),
|
||||
(country: "US", city: "Birmingham"),
|
||||
(country: "UK", city: "Birmingham")]
|
||||
|
||||
echo "Original order:"
|
||||
for record in Records:
|
||||
echo record.country, " ", record.city
|
||||
echo()
|
||||
|
||||
echo "Sorted by city name:"
|
||||
for record in Records.sortedByIt(it.city):
|
||||
echo record.country, " ", record.city
|
||||
echo()
|
||||
|
||||
echo "Sorted by country name:"
|
||||
for record in Records.sortedByIt(it.country):
|
||||
echo record.country, " ", record.city
|
||||
Loading…
Add table
Add a link
Reference in a new issue