Skip to main content Accessibility help
Internet Explorer 11 is being discontinued by Microsoft in August 2021. If you have difficulties viewing the site on Internet Explorer 11 we recommend using a different browser such as Microsoft Edge, Google Chrome, Apple Safari or Mozilla Firefox.

Chapter 6: The Use-It-Or-Lose-It Principle

Chapter 6: The Use-It-Or-Lose-It Principle

pp. 87-99

Authors

, Harvey Mudd College, California, , Harvey Mudd College, California
Resources available Unlock the full potential of this textbook with additional resources. There are Instructor restricted resources available for this textbook. Explore resources
  • Add bookmark
  • Cite
  • Share

Summary

So far, everything we’ve done with recursion we could have also done with for loops. The recursive functions that we’ve seen were conceptually somewhat different from the for loop versions, but recursion hasn’t yet given us powers to compute things that we couldn’t compute before. But now it will!

Peptide Fragments

Imagine that we have a set of fragments of proteins, where each fragment has a given mass. For example, the masses of five protein fragments might be [2, 3, 8, 10, 12] in some unit of mass. In addition, we know the mass of the original protein, say 25 units for the sake of example. The question is whether or not there is a subset of our list of fragment masses that add up to the mass of the protein. In this example, the answer is “yes”: fragments with masses 3, 10, and 12 add up to 25. On the other hand, if the fragments had masses [2, 15, 17, 20], we could not have found a subset that adds up to 25. For now, we’re assuming that each mass in the list can be used at most once. This problem arises in the study of protein structure and has been the focus of a recent study.

About the book

Access options

Review the options below to login to check your access.

Purchase options

eTextbook
US$63.00
Hardback
US$110.00
Paperback
US$63.00

Have an access code?

To redeem an access code, please log in with your personal login.

If you believe you should have access to this content, please contact your institutional librarian or consult our FAQ page for further information about accessing our content.

Also available to purchase from these educational ebook suppliers