Chapter Overview
Learn what we will be covering in this chapter.
“I think that’s what scares me: the randomness of everything. That the people who could be important to you might just pass you by. Or you pass them by."
Though this chapter introduces arrays, the chapter begins with a new concept of the reference variables, followed by the concept of random number generation.
We have seen functions returning a single value, but when we’re working with multiple variables and want to return multiple values from a function, we can call them by their reference or address. We’ll see how in detail in the upcoming lessons.
So far, we’ve been taking input data from the user to perform whatever operations we want. In this chapter, instead of taking the user’s input, we’ll learn to do the following:
- Read data from a file.
- Generate random data to perform different operations.
We’ll then learn about handling a list of data stored in a data structure called an array. Using sets as an example case study, we’ll practice simple problems using arrays like set union, intersection, subsets, set-difference, and cross-product. We will look at their implementations without using functions (by practicing nested loops) and using functions (by practicing the modularization approach) along with their advantages.
Furthermore, we will learn several ways to initialize arrays (with random and non-random data) through an extensive exercise.