Название: Quick Recursion (Quick Programming) Автор: David Matuszek Издательство: CRC Press Год: 2023 Страниц: 159 Язык: английский Формат: pdf (true) Размер: 10.2 MB
Recursion is the best tool for working with trees and graphs. But perhaps you’ve studied recursion and decided it’s too complicated. You just can’t think that way. That limits the kind of programming you can do. Good news! Recursion is actually easy. It’s just badly taught. See, many instructors talk about how the computer does it. They go on and on about what happens at each level of the recursion and how each level relates to other levels. The problem is that you can’t think in multiple levels. Nobody can. And you don’t have to. This book will show you how you can write recursive programs. Once you understand a few simple rules, you will wonder why you ever thought recursion was complicated. You’ll be able to write recursive programs quickly and easily. Well, as quick and easy as programming ever is, anyway.
Any programming book needs examples, and examples have to be in some language. This book uses two well-known languages, Java and Python 3. The code is kept simple, without any language-specific “tricks,” so it should be accessible even to programmers who know neither of these languages. That said, it is impossible to avoid all language-specific features and still have working code. Python uses indentation to show nesting of statements, while Java uses braces. To remove leading blanks, Python uses strip() while Java uses trim(). Differences such as these should not greatly obscure the examples.
Recursion is considered to be an “advanced” topic. It shouldn’t be. When my oldest daughter was in high school, she was deeply involved in a multiplayer dungeon (MUD) game. She implemented an email system for it, using a language called Forth, which uses recursion extensively. When she went to college, she took a programming class. After a week or so she called home and asked me, “Daddy, what are loops for?” When I explained, she said, “Why not just use recursion? It’s so much simpler.” I agree.
Внимание
Уважаемый посетитель, Вы зашли на сайт как незарегистрированный пользователь.
Мы рекомендуем Вам зарегистрироваться либо войти на сайт под своим именем.
Информация
Посетители, находящиеся в группе Гости, не могут оставлять комментарии к данной публикации.