CHAPTER 2
RECURSION AND COMBINATORICS
This chapter introduces you to the concept of recursion, along with various Java code samples, and then an introduction to concepts in combinatorics, such as combination and permutations of objects.
The first part of this chapter discusses recursion, which is the most significant portion of the chapter. The code samples include finding the sum of an arithmetic series (e.g., the numbers from 1 to n), calculating the sum of a geometric series, calculating factorial values, and calculating Fibonacci numbers. Except for the iterative solution to Fibonacci numbers, these code samples do not involve data structures. However, the examples provide a foundation for working with recursion.
If you are new to recursion ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access