From ae41462776e924a589466be59acc96deabe17690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogumi=C5=82=20Kami=C5=84ski?= Date: Fri, 14 Oct 2022 12:39:14 +0200 Subject: [PATCH] minor ch 14 exercises fixes --- exercises/exercises14.md | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/exercises/exercises14.md b/exercises/exercises14.md index dc9cc7a..0c56fc1 100644 --- a/exercises/exercises14.md +++ b/exercises/exercises14.md @@ -15,10 +15,9 @@ average number of items from this set that were drawn at least once. Call the function running this simulation `boot`.
- Solution -Solution (there are many other approaches you could use): +There are many other approaches you could use: ``` using Statistics @@ -45,11 +44,8 @@ Make this function single threaded. Check how long this function runs for `n=1000` and `k=1_000_000`.
- Solution -Solution: - ``` function simboot(k::Integer, n::Integer) result = [boot(n) for _ in 1:k] @@ -83,11 +79,8 @@ Call the function `simbootT`. Check how long this function runs for `n=1000` and `k=1_000_000`.
- Solution -Solution: - ``` using ThreadsX @@ -125,11 +118,8 @@ does not do any allocations internally). Call these new functions `boot!` and functions.
- Solution -Solution: - ``` function boot!(n::Integer, pool) table = pool[Threads.threadid()] @@ -180,11 +170,10 @@ use the `@timed` macro in your solution. Start the server.
- Solution -Solution (I used the simplest single-threaded code here; this is a complete -code of the web service): +I used the simplest single-threaded code here; this is a complete +code of the web service: ``` using Genie @@ -234,11 +223,8 @@ the following parameters: * `k=1.5` and `n=1000`
- Solution -Solution: - ``` julia> using HTTP @@ -279,11 +265,8 @@ Collect the data generated by a web service into the `df` data frame for `k = [10^i for i in 3:6]` and `n = [10^i for i in 1:3]`.
- Solution -Solution: - ``` using DataFrames @@ -329,11 +312,8 @@ julia> df Replace the `value` column in the `df` data frame by its contents in-place.
- Solution -Solution: - ``` julia> select!(df, :status, :time, :value => AsTable) 12×7 DataFrame @@ -362,11 +342,8 @@ Checks that execution time roughly scales proportionally to the product of `k` times `n`.
- Solution -Solution: - ``` julia> using DataFramesMeta @@ -397,10 +374,8 @@ Plot the expected fraction of seen elements in the set as a function of `n` by `k` along with 95% confidence interval around these values.
- Solution -Solution: ``` using Plots gdf = groupby(df, :k, sort=true)