Chapter 2. Building Blocks
This chapter serves as a refresher on some fundamentals concepts.
How fast could an algorithm run? How does it fare when you have ten input elements versus a million? To answer such questions, we need to be aware of the notion of algorithmic complexity, which is expressed using the Big O notation. An O(1) algorithm is faster than O(logn), for example.
What is this notation? It talks about measuring the efficiency of an algorithm, which is proportional to the number of data items, N, being processed.
This chapter starts with a look at the O notation. Space/time trade-off is another important aspect of algorithm design. Let's look at a dynamic programming problem to better understand this fundamental notion.
Next, we will look at vectors and list data structures and note the trade-offs.
We will conclude by looking at the complexities of some functional idioms.
By the end of this chapter, you will have a good understanding of algorithmic complexities....