## Advanced Programming Techniques (2011, 2013)

### Preface

Learning to program a computer is a frustrating task for many people. In my teaching experience I have found that much of this frustration comes because students are not shown enough programming examples. All of us learn by watching others, so why should learning to program a computer be any different? I wrote this book with minimal text but filled with many computer programming examples to help students and professionals learn computer programming more efficiently and thoroughly with less frustration.

**Who Should Read This Book?**

I wrote this book for my students graduating with a degree in computer science or information technology from Brigham Young University – Idaho. Consequently, those that will benefit most from reading this book are fourth year undergraduate students, graduate students, and software developers with less than three years of work experience. Each chapter within this book starts with content easily understood by second year undergraduate students and moves quickly to more difficult content. This is my attempt to lure students to study content that is more difficult than they normally would.

**How to Use This Book**

You can use this book as a tutorial or a reference. When using it as a tutorial, you will find it helpful to step through the example code line by line as if you were a computer. Doing this is sometimes called a **desk check** because you are checking the code on paper or “at your desk” instead of running it on a computer. To aid you in desk checking the example code, I have provided desk check locations throughout the book. Each desk check location includes a list of all the variables found in the corresponding example code and values for the input variables. To perform a desk check, step through the code as if you were the computer and change the value of each variable just as the computer would. The answers to all desk checks are in __Appendix B__.

Because of the many code examples in this book, you may also use it as a reference where you can find how to correctly implement and use algorithms, including binary search; setting, clearing, and counting bits; converting recursion to iteration and vice versa; computing the intersection, union, and complement of two sets; computing in a numerically stable way the mean and variance of a sample and the correlation of two samples; and much more. All the code examples in this book are written in Java except for those in __Chapter 3 Linked Lists__, which are written in C.