Algorithms For Dummies. John Paul Mueller
experimented with putting processors directly into the brain, but the latest innovation relies on the use of veins to make the connection (
https://www.independent.co.uk/life-style/gadgets-and-tech/brain-computer-interface-vein-als-stent-neuralink-b1556167.html
). Imagine a system in which humans can solve problems using algorithms at the speed of computers, but with the creative “what if” potential of humans.
Networks: Sharing is more than caring
Unless you have unlimited funds, using some algorithms effectively may not be possible, even with specialized chips. In that case, you can network computers together. Using special software, one computer, a host, can use the processors of all client computers running an agent (a kind of in-memory background application that makes the processor available). Using this approach, you can solve incredibly complex problems by offloading pieces of the problem to a number of client computers. As each computer in the network solves its part of the problem, it sends the results back to the host, which puts the pieces together to create a consolidated answer, a technique called cluster computing.
Lest you think this is the stuff of science fiction, people are using cluster computing techniques (https://www.geeksforgeeks.org/an-overview-of-cluster-computing/
) in all sorts of interesting ways. For example, the article at https://turingpi.com/12-amazing-raspberry-pi-cluster-use-cases/
details how you can build your own supercomputer (among other tasks) by combining multiple Raspberry Pi (https://www.raspberrypi.org/
) boards into a single cluster.
Distributed computing, another version of cluster computing (but with a looser organization) is also popular. In fact, you can find a list of distributed computing projects at https://en.wikipedia.org/wiki/List_of_distributed_computing_projects
. The list of projects includes some major endeavors, such as Search for Extraterrestrial Intelligence (SETI). You can also donate your computer’s extra processing power to work on a cure for cancer. The list of potential projects is amazing. Most of these projects are hosted by Berkeley Open Infrastructure for Network Computing (https://boinc.berkeley.edu/
), but you can find other sponsors.
Leveraging available data
Part of solving problem using an algorithm has nothing to do with processing power, creative thinking outside the box, or anything of a physical nature. To create a solution to most problems, you also need data on which to base a conclusion. For example, in the toast-making algorithm, you need to know about the availability of bread, a toaster, electricity to power the toaster, and so on before you can solve the problem of actually making toast. The data becomes important because you can’t finish the algorithm when missing even one element of the required solution. Of course, you may need additional input data as well. For example, the person wanting the toast may not like rye. If this is the case and all you have is rye bread to use, the presence of bread still won’t result in a successful result.
Data comes from all sorts of sources and in all kinds of forms. You can stream data from a source such as a real-time monitor, access a public data source, rely on private data in a database, scrape the data from websites, or get it in myriad other ways too numerous to mention here. The data may be static (unchanging) or dynamic (constantly changing). You may find that the data is complete or missing elements. The data may not appear in the right form (such as when you get imperial units and require metric units when solving a weight problem). The data may appear in a tabular format when you need it in some other form. It may reside in an unstructured way (for instance, in a NoSQL database or just in a bunch of different data files) when you need the formatting of a relational database. In short, you need to know all sorts of things about the data used with your algorithm in order to solve problems with it.
Because data comes in so many forms and you need to work with it in so many ways, this book pays a lot of attention to data. Starting in Chapter 6, you discover just how data structure comes into play. Moving on to Chapter 7, you begin looking at how to search through data to find what you need. Chapters 12 through 14 help you work with big data. However, you can find some sort of data-specific information in just about every chapter of the book because without data, an algorithm can’t solve any problems.
Distinguishing between Issues and Solutions
This book discusses two parts of the algorithmic view of the real world. On the one hand, you have issues, which are problems that you need to solve. An issue can describe the desired output of an algorithm, or it can describe a hurdle you must overcome to obtain the desired output. Solutions are the methods, or steps, used to address the issues. A solution can relate to just one step or many steps within the algorithm. In fact, the output of an algorithm, the response to the last step, is a solution. The following sections help you understand some of the important aspects of issues and solutions.
Being correct and efficient
Using algorithms is all about getting an acceptable answer. The reason you look for an acceptable answer is that some algorithms generate more than one answer in response to fuzzy input data. Life often makes precise answers impossible to get. Of course, getting a precise answer is always the goal, but often you end up with an acceptable answer instead.
Getting the most precise answer possible may take too much time. When you seek a precise answer that takes too long to obtain, the information becomes useless and you’ve wasted your time. Choosing between two algorithms that address the same issue may come down to a choice between speed and precision. A fast algorithm may not generate a precise answer, but the answer may still work well enough to provide useful output.
Wrong answers can be a problem. Creating a lot of wrong answers fast is just as bad as creating a lot of precisely correct answers slowly. Part of the focus of this book is helping you find the middle ground between too fast and too slow, and between inaccurate and too accurate. Even though your math teacher stressed the need for providing the correct answer in the way expressed by the book you used at the time, real-world math often involves weighing choices and making middle-ground decisions that affect you in ways you might not think possible.
Discovering there is no free lunch
You may have heard the common myth that you can have everything in the way of computer output without putting much effort into deriving the solution. Unfortunately, no absolute solution exists to any problem, and better answers are often quite costly. When working with algorithms, you quickly discover the need to provide additional resources when you require precise answers quickly. The size and complexity of the data sources you use greatly affect the solution resolution as well. As size and complexity increase, you find that the need to add resources increases as well.
Adapting the strategy to the problem
Part 5 of this book looks at strategies you can use to decrease the cost of working with algorithms. The best mathematicians use tricks to get more output from less computing. For example, you can create an