Skip to main content

Recursive Operations: Walks

  • Chapter
Pro Java 7 NIO.2
  • 747 Accesses

Abstract

As you probably know, recursive programming is a debated technique because it usually needs a lot of memory but it simplifies some programming tasks. Basically, a recursive programming is a situation in which a procedure calls itself, passing in a modified value of the parameter or parameters that were passed in to the current iteration of the procedure. Programming tasks such as calculating factorial, Fibonacci numbers, anagrams, and Sierpinski carpet are just a few of the well-known tasks that can be accomplished through the recursive programming technique. The following code snippet uses this technique to calculate the factorial (n! = 1 * 2 * 3* ... *n)—notice how the procedure calls itself:

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 49.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2011 Anghel Leonard

About this chapter

Cite this chapter

Leonard, A. (2011). Recursive Operations: Walks. In: Pro Java 7 NIO.2. Apress. https://doi.org/10.1007/978-1-4302-4012-9_5

Download citation

Publish with us

Policies and ethics