This assignment helps you explore concepts from the analysis of algorithms, specifically the "big-O" notation and its use in evaluating implementations.
Steps:
-
Fill out the (minimal) starter code in
src/
. Make sure the (minimal) tests pass on your implementations. -
Answer the following question: why do the tests for
unique_set
usesort
, but the test forunique_2loops
do not? If you get stuck, see?Set
. -
Create the benchmarks in
benchmarks/run_benchmarks.jl
. The end result should be a few global variables that store information about the sizes of the lists and the runtime needed to execute the algorithm(s). -
Pick a plotting package (your choice): popular options include Makie, Plots, and PyPlot. Makie is not recommended for this assignment unless you're running at least Julia 1.9. (Makie is the most sophisticated and a good investment for anyone considering Julia for the long term, but it currently has long load and precompilation times; Plots or PyPlot are leaner options. Any of these should be more than sufficient for this assignment.)
-
Plot your results, filling out a plotting script in
plot_benchmarks.jl
. -
In big-O notation, what order is
unique_2loops
when there are only 10 unique items? What is its order when the number of unique items is half the length of the list? For the same two cases, what order isunique_set
? -
To get a glimpse of how
Set
s work, fill out the exercise inexamples/hashtable.jl
. Then fill out the number of "hash collisions" (slots in the table that got more than one item inserted in them) for tables of the following sizes:- 16:
- 32:
- 64:
- 128: