There are several reasons why you should study algorithms. I’m going to talk about four of them. (If you want to skip to the bottom, you can read about the drawing I’m having in the next few days for one of these books.)
First, it teaches you how to build specific algorithms. For example, pretty much any introductory algorithms book explains certain basic algorithms, one of which is quicksort. Quicksort is a good, general-purpose sorting algorithm that’s usually quite fast. After you learn how it works, you can use it in your programs.
But wait! Don’t many programming languages include sorting utilities? Yes they do. In fact, many of them use quicksort, at least under some circumstances. The reason they don’t use quicksort all of the time is that other algorithms are sometimes faster. For example, the countingsort can be much faster if the values being sorted are integers that span a relatively small range. For example, countingsort would work quite well if you need to sort 1 million integer values between 1 and 10,000. For another example, bubblesort is very fast for sorting small lists. For example, it is often faster than quicksort or countingsort if you only need to sort 5 items.
That brings me to the second reason why you should study algorithms: so you know which algorithm to use under different circumstances. Studying algorithms lets you know what kinds of algorithms are possible and which might be best suited for a particular problem. The .NET Framework includes sorting tools, but you may be able to sort much more quickly if you have special information about the data that you are sorting. A good background in algorithms will let you know what other kinds of algorithms are out there for building trees, searching databases, finding paths through networks, solving optimization problems, fitting curves to points, and many other useful tasks.
The third reason for studying algorithms, and the one that is probably the most important, it that it gives your brain a workout. Professional football players spend plenty of time in the gym even though they will rarely need to perform bench presses during a game. Similarly, working with a variety of algorithms exercises your brain. It teaches you new techniques for solving problems. It also teaches you problem-solving approaches that you may help you find solutions to completely unrelated problems. It’s practice for solving the problems that you will actually face on the mean streets of programming.
(This is also the main reason why you learn algebra in school. It’s not that your teachers think everyone will use algebra or calculus in their daily lives. They’re trying to make youi smarter.)
The final reason for studying algorithms (at least the final reason that I’m going to talk about now) is that they’re fun! Figuring out how to implement a tricky algorithm is sort of like solving a jigsaw or Sudoku puzzle. It’s a great feeling when all of the pieces fit together to give you something whole. Unlike Sudoko, however, when you’re done implementing an algorithm, you have something useful. It’s also an amazing feeling to dump a bunch of data into a 3D graphics program and have a colorful fractal or photo-realistic picture pop out!
Over the years I have written many books that are largely workouts for your brain. Those include algorithms books, 2- and 3-dimensional graphics books, miscellaneous interesting topics books, and even a book about interview puzzles. (Even my database design book will probably make you think.) Here are my latest titles that fit this category.
The Modern C# Challenge, Become an expert C# programmer by solving interesting programming problems
This book includes 100 problems (with solutions) that you can use to test and hone your C# programming skills. They cover an eclectic assortment of topics, such as mathematical calculations, geometry, dates and times, the filesystem, simulations, and cryptography. These problems won’t make you an expert in those fields, but they will give you some experience with a wide variety of useful topics.
WPF 3d, Three-Dimensional Graphics with WPF and C#
This easy-to-read guide provides everything you need to know to get started writing striking 3D graphics programs with WPF and C#. The book’s three parts describe 3D basics, building many different shapes, and advanced topics. More than 100 example programs covering such topics as:
- The lights, cameras, materials, texture coordinates, and other details that you need to create a 3D scene
- Orthographic, perspective, and other projections that emphasize different aspects of a scene
- Special material treatments such as specular reflection, wireframes, and solid and translucent materials
- Examples of many shapes including flat polygons, boxes, Platonic solids, spheres, tori, cones, and more
- Advanced objects such as parametric surfaces, surfaces of transformation, fractal surfaces, and 2D and 3D text
- Higher-level scene management to let users select and move objects
- Advanced techniques such as loading models created in other applications and using skeletons
Interview Puzzles Dissected, Solving and Understanding Interview Puzzles
Job Candidates, Interviewers, and Puzzle Enthusiasts
Whether you’re applying for a programming job or a position on Wall Street, interview puzzles are the norm at many high-tech companies. This book explains how to solve more than 200 of the hardest and most common interview puzzles in use. Interview Puzzles Dissected:
- Shows how to solve more than 200 challenging interview puzzles
- Reveals underlying techniques that let you solve problems that you haven’t seen before
- Tells how you can show the interviewer that you can think in an organized fashion
- Explains how to get “partial credit” when all else fails and you just can’t solve a puzzle
- Includes programming challenges to give you a deeper understanding of puzzles (obviously only if you’re a programmer)
Essential Algorithms, A Practical Approach to Computer Algorithms
A friendly and accessible introduction to the most useful algorithms.
Computer algorithms are the basic recipes for programming. Professional programmers need to know how to use algorithms to solve difficult programming problems. Written in simple, intuitive English, this book describes how and when to use the most practical classic algorithms, and even how to create new algorithms to meet future needs. The book also includes a collection of questions that can help readers prepare for a programming job interview.
I’m holding a drawing to give away 10 free copies of my book The Modern C# Challenge. To enter, simply send your name and email address to me at RodStephens@CSharpHelper.com. Use the subject line “The Modern C# Challenge book drawing” so I know what your email is about. All I ask in return is that you post a review. The deadline is January 18, 2019, so act now!
For a little more information, look at this post.