© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2021
T. LaversLearn to Program with Kotlinhttps://doi.org/10.1007/978-1-4842-6815-5_11

11. Anagrams

Tim Lavers1  
(1)
Woonona, NSW, Australia
 

This chapter builds on the techniques of object-oriented programming and unit testing that were used in Chapter 10 and introduces a new programming technique, recursion . The problem that we will solve is the following: given any English word, what are all the anagrams of it?

11.1 Main Classes

Suppose that we want to find all the anagrams of some given word. One approach is as follows: first, we work out all of the different ways of rearranging the letters in the word, and then we check each arrangement against a list of known ...

Get Learn to Program with Kotlin: From the Basics to Projects with Text and Image Processing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.