0%

Book Description

When programmers list their favorite books, Jon Bentley’s collection of programming pearls is commonly included among the classics. Just as natural pearls grow from grains of sand that irritate oysters, programming pearls have grown from real problems that have irritated real programmers. With origins beyond solid engineering, in the realm of insight and creativity, Bentley’s pearls offer unique and clever solutions to those nagging problems. Illustrated by programs designed as much for fun as for instruction, the book is filled with lucid and witty descriptions of practical programming techniques and fundamental design principles. It is not at all surprising that Programming Pearls has been so highly valued by programmers at every level of experience.

In this revision, the first in 14 years, Bentley has substantially updated his essays to reflect current programming methods and environments. In addition, there are three new essays on

  • testing, debugging, and timing

  • set representations

  • string problems

  • All the original programs have been rewritten, and an equal amount of new code has been generated. Implementations of all the programs, in C or C++, are now available on the Web.

    What remains the same in this new edition is Bentley’s focus on the hard core of programming problems and his delivery of workable solutions to those problems. Whether you are new to Bentley’s classic or are revisiting his work for some fresh insight, the book is sure to make your own list of favorites.

    Table of Contents

    1. About This E-Book
    2. Title Page
    3. Copyright Page
    4. Preface
      1. About the Book
      2. The Code
      3. To Readers of the First Edition
      4. Acknowledgments for the First Edition
      5. Acknowledgments for the Second Edition
    5. Contents
    6. Part I: Preliminaries
      1. Column 1: Cracking the Oyster
        1. 1.1 A Friendly Conversation
        2. 1.2 Precise Problem Statement
        3. 1.3 Program Design
        4. 1.4 Implementation Sketch
        5. 1.5 Principles
        6. 1.6 Problems
        7. 1.7 Further Reading
      2. Column 2: Aha! Algorithms
        1. 2.1 Three Problems
        2. 2.2 Ubiquitous Binary Search
        3. 2.3 The Power of Primitives
        4. 2.4 Getting It Together: Sorting
        5. 2.5 Principles
        6. 2.6 Problems
        7. 2.7 Further Reading
        8. 2.8 Implementing an Anagram Program [Sidebar]
      3. Column 3: Data Structures Programs
        1. 3.1 A Survey Program
        2. 3.2 Form-Letter Programming
        3. 3.3 An Array of Examples
        4. 3.4 Structuring Data
        5. 3.5 Powerful Tools for Specialized Data
        6. 3.6 Principles
        7. 3.7 Problems
        8. 3.8 Further Reading
      4. Column 4: Writing Correct Programs
        1. 4.1 The Challenge of Binary Search
        2. 4.2 Writing the Program
        3. 4.3 Understanding the Program
        4. 4.4 Principles
        5. 4.5 The Roles of Program Verification
        6. 4.6 Problems
        7. 4.7 Further Reading
      5. Column 5: A Small Matter of Programming
        1. 5.1 From Pseudocode to C
        2. 5.2 A Test Harness
        3. 5.3 The Art of Assertion
        4. 5.4 Automated Testing
        5. 5.5 Timing
        6. 5.6 The Complete Program
        7. 5.7 Principles
        8. 5.8 Problems
        9. 5.9 Further Reading
        10. 5.10 Debugging [Sidebar]
    7. Part II: Performance
      1. Column 6: Perspective on Performance
        1. 6.1 A Case Study
        2. 6.2 Design Levels
        3. 6.3 Principles
        4. 6.4 Problems
        5. 6.5 Further Reading
      2. Column 7: The Back of the Envelope
        1. 7.1 Basic Skills
        2. 7.2 Performance Estimates
        3. 7.3 Safety Factors
        4. 7.4 Little’s Law
        5. 7.5 Principles
        6. 7.6 Problems
        7. 7.7 Further Reading
        8. 7.8 Quick Calculations in Everyday Life [Sidebar]
      3. Column 8: Algorithm Design Techniques
        1. 8.1 The Problem and a Simple Algorithm
        2. 8.2 Two Quadratic Algorithms
        3. 8.3 A Divide-and-Conquer Algorithm
        4. 8.4 A Scanning Algorithm
        5. 8.5 What Does It Matter?
        6. 8.6 Principles
        7. 8.7 Problems
        8. 8.8 Further Reading
      4. Column 9: Code Tuning
        1. 9.1 A Typical Story
        2. 9.2 A First Aid Sampler
        3. 9.3 Major Surgery — Binary Search
        4. 9.4 Principles
        5. 9.5 Problems
        6. 9.6 Further Reading
      5. Column 10: Squeezing Space
        1. 10.1 The Key — Simplicity
        2. 10.2 An Illustrative Problem
        3. 10.3 Techniques for Data Space
        4. 10.4 Techniques for Code Space
        5. 10.5 Principles
        6. 10.6 Problems
        7. 10.7 Further Reading
        8. 10.8 A Big Squeeze [Sidebar]
    8. Part III: The Product
      1. Column 11: Sorting
        1. 11.1 Insertion Sort
        2. 11.2 A Simple Quicksort
        3. 11.3 Better Quicksorts
        4. 11.4 Principles
        5. 11.5 Problems
        6. 11.6 Further Reading
      2. Column 12: A Sample Problem
        1. 12.1 The Problem
        2. 12.2 One Solution
        3. 12.3 The Design Space
        4. 12.4 Principles
        5. 12.5 Problems
        6. 12.6 Further Reading
      3. Column 13: Searching
        1. 13.1 The Interface
        2. 13.2 Linear Structures
        3. 13.3 Binary Search Trees
        4. 13.4 Structures for Integers
        5. 13.5 Principles
        6. 13.6 Problems
        7. 13.7 Further Reading
        8. 13.8 A Real Searching Problem [Sidebar]
      4. Column 14: Heaps
        1. 14.1 The Data Structure
        2. 14.2 Two Critical Functions
        3. 14.3 Priority Queues
        4. 14.4 A Sorting Algorithm
        5. 14.5 Principles
        6. 14.6 Problems
        7. 14.7 Further Reading
      5. Column 15: Strings of Pearls
        1. 15.1 Words
        2. 15.2 Phrases
        3. 15.3 Generating Text
        4. 15.4 Principles
        5. 15.5 Problems
        6. 15.6 Further Reading
    9. Epilog to the First Edition
    10. Epilog to The Second Edition
    11. Appendix 1: A Catalog of Algorithms
      1. Sorting
      2. Searching
      3. Other Set Algorithms
      4. Algorithms on Strings
      5. Vector and Matrix Algorithms
      6. Random Objects
      7. Numerical Algorithms
    12. Appendix 2: An Estimation Quiz
    13. Appendix 3: Cost Models for Time and Space
    14. Appendix 4: Rules for Code Tuning
      1. Space-For-Time Rules
      2. Time-For-Space Rules
      3. Loop Rules
      4. Logic Rules
      5. Procedure Rules
      6. Expression Rules
    15. Appendix 5: C++ Classes for Searching
    16. Hints for Selected Problems
      1. Column 1
      2. Column 2
      3. Column 3
      4. Column 4
      5. Column 5
      6. Column 6
      7. Column 7
      8. Column 8
      9. Column 9
      10. Column 10
      11. Column 11
      12. Column 12
      13. Column 13
      14. Column 14
      15. Column 15
    17. Solutions to Selected Problems
      1. Solutions for Column 1
      2. Solutions for Column 2
      3. Solutions for Column 3
      4. Solutions for Column 4
      5. Solutions for Column 5
      6. Solutions for Column 6
      7. Solutions for Column 7
      8. Solutions for Column 8
      9. Solutions for Column 9
      10. Solutions for Column 10
      11. Solutions for Column 11
      12. Solutions for Column 12
      13. Solutions for Column 13
      14. Solutions for Column 14
      15. Solutions for Column 15
    18. Index
    19. Code Snippets
    18.189.170.134