July 2021
Intermediate to advanced
768 pages
25h 23m
English
If you are reading this book, you are probably already familiar with loops. As discussed in appendix A, for, while, and do-while loops (and some more, depending on the language) all are examples of iteration.
Iterative loops are one straightforward way to repeatedly perform similar actions on a series of elements. Usually loops go hand in hand with certain data structures, for example, containers like lists and arrays.
Loops tend to work well when the data structure has a linear shape; sometimes, though, things are more complicated and a simple loop might not be enough to immediately solve the issue. We will see, for example, how trees and graphs are more challenging than lists. There are workarounds to use loops with ...