Skip to content

sleep sort works by starting a separate task for each item to be sorted, where each task sleeps for an interval corresponding to the item's sort key, then emits the item

License

Notifications You must be signed in to change notification settings

hh-ex/kata-sleepsort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sleep sort kata

In general, sleep sort works by starting a separate task for each item to be sorted, where each task sleeps for an interval corresponding to the item's sort key, then emits the item. Items are then collected sequentially in time.

Task: Write a program that implements sleep sort. Have it accept non-negative integers and return the integers in sorted order.

Enhancements for optimization, generalization, practicality, robustness, and so on are not required. But welcome!

  Sleep.sort([2,1,7,4,3])
  # [1,2,3,4,7]

from: Rosetta Code which lacks a Elixir solution

About

sleep sort works by starting a separate task for each item to be sorted, where each task sleeps for an interval corresponding to the item's sort key, then emits the item

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages