diff options
| author | Paul Buetow <paul@buetow.org> | 2023-04-09 23:04:09 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-04-09 23:04:09 +0300 |
| commit | c5b04ce8c9ab1c45f7491784faf3b2b0e58df264 (patch) | |
| tree | 65a5ea9497851462b8164118438573fa9de3d3f4 | |
| parent | 6286c69737aa31afddfc84e77abac729d588b8d3 (diff) | |
Update content for md
| -rw-r--r-- | gemfeed/2023-04-09-algorithms-and-data-structures-in-golang-part-1.md | 2 | ||||
| -rw-r--r-- | index.md | 2 | ||||
| -rw-r--r-- | uptime-stats.md | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/gemfeed/2023-04-09-algorithms-and-data-structures-in-golang-part-1.md b/gemfeed/2023-04-09-algorithms-and-data-structures-in-golang-part-1.md index b1e7bd0a..3c1dee8e 100644 --- a/gemfeed/2023-04-09-algorithms-and-data-structures-in-golang-part-1.md +++ b/gemfeed/2023-04-09-algorithms-and-data-structures-in-golang-part-1.md @@ -189,6 +189,8 @@ func Sleep[V ds.Integer](a ds.ArrayList[V]) ds.ArrayList[V] { } ``` +This Go code implements the sleep sort algorithm using generics and goroutines. The main function `Sleep[V ds.Integer](a ds.ArrayList[V]) ds.ArrayList[V]` takes a generic `ArrayList` as input and returns a sorted `ArrayList`. The code creates a separate goroutine for each element in the input array, sleeps for a duration proportional to the element's value, and then sends the element to a channel. Another goroutine waits for all the sleeping goroutines to finish and then closes the channel. The sorted result `ArrayList` is constructed by appending the elements received from the channel in the order they arrive. The `sync.WaitGroup` is used to synchronize goroutines and ensure that all of them have completed before closing the channel. + ### Testing For testing, we only allow values up to 10, as otherwise, it would take too long to finish: @@ -1,6 +1,6 @@ # foo.zone -> This site was generated at 2023-04-09T22:38:01+03:00 by `Gemtexter` +> This site was generated at 2023-04-09T23:03:53+03:00 by `Gemtexter` ``` |\---/| diff --git a/uptime-stats.md b/uptime-stats.md index d45c16df..9f792e59 100644 --- a/uptime-stats.md +++ b/uptime-stats.md @@ -1,6 +1,6 @@ # My machine uptime stats -> This site was last updated at 2023-04-09T22:38:01+03:00 +> This site was last updated at 2023-04-09T23:03:53+03:00 The following stats were collected via `uptimed` on all of my personal computers over many years and the output was generated by `guprecords`, the global uptime records stats analyser of mine. |
