Skip to content

1.2 Algorithms as a technology

1.2-1

Give an example of an application that requires algorithmic content at the application level, and discuss the function of the algorithms involved.

I just created a table showing recently studied sections of this book using the Dataview plugin in Obsidian. It involved sorting algorithms based on the modified time of files and maybe some data structures to filter only the files with a certain tag.

1.2-2

Suppose that for inputs of size nn on a particular computer, insertion sort runs in 8n28n^2 steps and merge sort runs in 64 nlgn64\ n \lg n steps. For which values of nn does insertion sort beat merge sort?

8n2<64 nlgnn<8log2n2n<n82n43 .\begin{aligned} 8n^2 &< 64\ n \lg n \\ n &< 8\log_2 n \\ 2^n &< n^8 \\ 2 \le n &\le 43 \ . \end{aligned}

1.2-3

What is the smallest value of nn such that an algorithm whose running time is 100n2100n^2 runs faster than an algorithm whose running time is 2n2^n on the same machine?

100n2<2nn15 .\begin{aligned} 100n^2 &< 2^n \\ n &\ge 15 \ . \end{aligned}