CHAPTER 16

MORE ON RECURSION

CHAPTER OUTLINE

16.1 Pattern Within a Pattern

16.2 Generalized Eight Queens Problem

16.3 Knight's Tour Problem

16.4 Stable Marriage Problem

16.5 Fractal (Hilbert Curve and Sierpinski Triangle)

16.6 Suduko

16.7 Guidelines on Using Recursion

In Chapter 8, we discussed recursion and its applications in detail. In this chapter, we focus on more advanced problems that can be solved using recursion.

16.1 PATTERN WITHIN A PATTERN

In this section, we will use recursion to print a picture comprising several squares within each other. For this purpose, we need to import a graphical package, and matplotlib is one such choice (discussed in detail in the next chapter). It contains methods for 2D graphics that would be required ...

Get Python Programming: A modular approach 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.