Lab

Efficient code

Write the following as a function. Use system.time() to explore how
long this takes to execute as n increases from 100 to 10000. Use
identical() and microbenchmark to compare
alternatives f1(), f2(), and f3() for both correctness and performance of
these three different functions. What strategies are these functions
using?