Chapter 21

Ten Algorithms That Are Changing the World

IN THIS CHAPTER

Bullet Considering sort and search routines

Bullet Using random numbers

Bullet Making data smaller

Bullet Ensuring that data remains secret, and more …

It’s hard to imagine an algorithm doing much of anything physical, much less changing the world. However, algorithms today appear everywhere, and you might not even realize just how much effect they have on your life.

Most people realize that online stores and other sales venues rely on algorithms to determine which add-on products to suggest based on previous purchases. However, most people are unaware of the uses of algorithms in medicine, many of which help a doctor decide what diagnosis to provide.

Algorithms appear in the oddest places. The timing of traffic lights often depends on the calculations of algorithms. Algorithms help your smartphone talk to you, and algorithms make your television do more than any television has done in the past. Consequently, it’s not all that impossible to believe that algorithms are poised to change the world. This chapter highlights ten of them.

Remember For algorithm purists, you can say that the algorithm has changed the world throughout the centuries, so nothing has really changed for thousands of years. The Babylonians used algorithms to perform factorization and find square roots as early as 1800 to 1600 BCE (https://www.historyofinformation.com/detail.php?entryid=4379). Al-Khawarizmi described algorithms to solve both linear and quadratic equations around 820 AD (https://www.newscientist.com/people/muhammad-ibn-musa-al-khwarizmi/). This chapter focuses on computer-based algorithms, but algorithms have been around for a long time.

Using Sort Routines

Without ordered data, most of the world would come to a stop. To use data, you must be able to find it. You can find hundreds of sort algorithms explained on sites such as https://betterexplained.com/articles/sorting-algorithms/ and as part of this book (see Chapter 7).

However, the three most common sort routines are merge sort, quick sort, and heapsort because of the superior speed they provide (see the time comparisons at https://www.cprogramming.com/tutorial/computersciencetheory/sortcomp.html). The sort routine that works best for your application depends on the following:

  • What you expect the application to do
  • The kind of data you work with
  • The computing resources you have available

The point is that the capability to sort data into whatever form an application needs to accomplish a task makes the world run, and this capability is changing how the world works.

Some businesses today thrive as a result of using sorting algorithms. For example, consider the fact that Google exists because it helps people find things, and this ability resides substantially in the capability to sort data to make it readily accessible. Consider just how hard it would be to find an item on Amazon without the sort routine. Even that recipe application on your computer at home relies heavily on sort routines to keep the data it contains in order. In fact, it probably wouldn’t be too much of a stretch to say that any substantial application relies heavily on sort routines.

Looking for Things with Search Routines

As with sort routines, search routines appear in nearly every application of any size today. The applications appear everywhere, even in places that you might not think too much about, such as your car. Finding information quickly is an essential part of daily life. For example, imagine being late for an appointment and suddenly discovering that your GPS can’t find the address you need. As with sort routines, search routines come in all shapes and sizes, and you can find them described on sites such as https://tekmarathon.com/2012/10/05/best-searching-algorithm-2/ and https://www.geeksforgeeks.org/searching-algorithms/. In fact, if anything, there are more search routines than sort routines because search requirements are often more strenuous and complex. You find a lot of search routines discussed in this book as well (see Chapter 7).

Shaking Things Up with Random Numbers

All sorts of things would be a lot less fun without randomness. For example, imagine starting Solitaire and seeing precisely the same game every time you start it. No one would play such a game. Consequently, random number generation is an essential part of the gaming experience. In fact, as expressed in a number of chapters in this book, some algorithms actually require some level of randomness to work properly (see the “Considering why randomization is needed” section of Chapter 17 as an example). You also find that testing works better when using random values in some cases (see the “Choosing a particular kind of compression” section of Chapter 14 as an example).

Remember The numbers that you obtain from an algorithm are usually from Pseudo-Random Number Generators (PRNGs), which means that you can potentially predict the next number in a series by knowing the algorithm and the seed value used to generate the number. That’s why this information is so closely guarded. It’s possible to install hardware on a computer to create a True Random Number Generator (TRNG), as described in the article “Generating Random Numbers Is a Lot Harder Than You Think” at https://betterprogramming.pub/generating-random-numbers-is-a-lot-harder-than-you-think-b121c3e75d08. Unfortunately, TRNGs come with some problems, like creating insecure cryptography in some cases. So, the article also describes the Cryptographically-Secure Pseudorandom Number Generator (CSPRNG). In other words, you may encounter all sorts of methods of creating random numbers, each with their own target use.

Technical stuff Computer hardware-based methods of creating random numbers can rely on atmospheric noise or temperature changes (see https://engineering.mit.edu/engage/ask-an-engineer/can-a-computer-generate-a-truly-random-number/ for details). In fact, you can get a hardware-based random number solution, such as TrueRNG (https://www.amazon.com/exec/obidos/ASIN/B01KR2JHTA/datacservip0f-20/) and ChaosKey (https://altusmetrum.org/ChaosKey/) (schematic only) and plug it into your USB slot to generate what likely are true random numbers. The interesting thing about the ChaosKey site is that it provides you with a schematic to show how it collects random noise and changes it into a random number.

Performing Data Compression

Chapter 14 discusses data compression techniques and uses the kind of compression that you normally find used for files. However, data compression affects every aspect of computing today. For example, most graphics, video, and audio files rely on data compression. Without data compression, you couldn’t possibly obtain the required level of throughput to make tasks such as streamed movies work.

However, data compression finds even more uses than you might expect. Just about every Database Management System (DBMS) relies on data compression to make data fit in a reasonable amount of space on disk. Cloud computing wouldn’t work without data compression because downloading items from the cloud to local machines would take too long. Even web pages often rely on data compression to get information from one place to another.

Keeping Data Secret

The concept of keeping data secret isn’t new. In fact, it’s one of the oldest reasons to use an algorithm of some sort. The word cryptography actually comes from two Greek words: kryptós (hidden or secret) and graphein (writing). In fact, the Greeks were probably the first users of cryptography (see https://www.britannica.com/topic/cipher), and ancient texts report that Julius Caesar used encrypted missives to communicate with his generals. The point is, keeping data secret is one of the longest running battles in history. The moment one party finds a way to keep a secret, someone else finds a way to make the secret public by breaking the cryptography. General uses for computer-driven cryptography today include:

  • Confidentiality: Ensuring that no one can see information exchanged between two parties
  • Data integrity: Reducing the likelihood that someone or something can change the content of data passed between two parties
  • Authentication: Determining the identity of one or more parties
  • Nonrepudiation: Reducing the ability of a party to say they didn’t commit a particular act

Tip Besides keeping a secret when using computers, the history of computer-based cryptographic algorithms is long and interesting. The “Hiding Your Secrets with Cryptography” section of Chapter 14 offers a good overview of cryptographic techniques. You can also find a list of commonly used algorithms (both present and historical) at https://www.axel.org/2021/05/28/history-of-encryption/ and https://komodoplatform.com/en/academy/history-of-cryptology/. The guide at https://www.owasp.org/index.php/Guide_to_Cryptography provides additional details on how cryptography works.

Changing the Data Domain

The Fourier Transform and Fast Fourier Transform (FFT) make a huge difference in how applications perceive data. These two algorithms transform data from the frequency domain (how fast a signal oscillates) to the time domain (the time differential between signal changes). In fact, it’s impossible to get any sort of computer hardware degree without having spent time working with these two algorithms extensively. Timing is everything.

Remember By knowing how often something changes, you can figure out the time interval between changes and therefore know how long you have to perform a task before a change in state requires that you do something else. These algorithms commonly see use in filters of all sorts. Without the filtering effects of these algorithms, reproducing video and audio faithfully through a streamed connection would be impossible. All these applications sound rather advanced, and they are, but some amazing tutorials give you a better sense of how these algorithms work (see the tutorial at https://w.astro.berkeley.edu/~jrg/ngst/fft/fft.html as an example). The tutorial at https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ is possibly the most interesting and especially entertaining if you like smoothies.

Analyzing Links

The capability to analyze relationships is something that has made modern computing unique. The capability to first create a representation of these relationships and then analyze them is the subject of Part 3 of this book. The whole idea of the web, in fact, is to create connections, and connectivity was a consideration at the start of what has become a worldwide phenomenon. Without the capability to analyze and utilize links, applications such as databases and email wouldn’t work. You couldn’t communicate well with friends on Facebook.

As the web has matured and people have become more in tune with devices that make connectivity both simpler and ubiquitous, applications such as Facebook and sales sites such as Amazon have made greater use of link analysis to do things like sell you more products. Of course, some of this connectivity has a negative outcome (see https://www.pcmag.com/opinions/facebook-a-tool-for-evil and https://www.minotdailynews.com/opinion/national-columnists/2021/10/facebook-the-new-evil-empire/ as examples), but for the most part, link analysis does make it possible for people to remain better informed and in better contact with the world around them.

Of course, link analysis does more than inform in a connected sort of way. Consider the use of link analysis to provide driving directions or to find casual links between human activity and disease. Link analysis enables you to see the connection between things that you might not ordinarily consider but that do have an impact on your daily life. Because of link analysis, you might live longer because a doctor can advise you on which habits to change to correct issues that could become problems later. The point is that connections exist everywhere, and link analysis offers a method to determine where these connections exist and whether they’re actually important.

Spotting Data Patterns

Data doesn’t exist in a vacuum. All sorts of factors affect data, including biases that color how humans perceive data. Chapter 10 discusses how data tends to cluster in certain environments and how analysis of these clusters can tell you all sorts of things about the data.

Tip Pattern analysis is at the forefront of some of the more amazing uses of computers today. For example, the Viola–Jones object detection framework (see https://towardsdatascience.com/understanding-face-detection-with-the-viola-jones-object-detection-framework-c55cc2a9da14 for details) makes real-time facial recognition possible. This algorithm could enable people to create better security in places like airports where nefarious individuals currently ply their trade. Similar algorithms could help your doctor detect cancers of various sorts long before the cancer is actually visible to the human eye. Earlier detection makes a full recovery a higher probability. The same holds true for all sorts of other medical problems (such as finding bone fractures that are currently too small to see but cause pain nonetheless).

You also find pattern recognition used for more mundane purposes. For example, pattern analysis lets people detect potential traffic problems before they occur. It’s also possible to use pattern analysis to help farmers grow more food at a lower cost by applying water and fertilizer only when necessary. The use of pattern recognition can also help move drones around fields so that the farmer becomes more time efficient and can work more land at a lower cost. Without algorithms, these sorts of patterns, which have such a high impact on daily life, can’t be recognized.

Dealing with Automation and Automatic Responses

The proportional integral derivative algorithm is quite a mouthful. Just try saying it three times fast! However, it’s one of the most important secret algorithms you’ve never heard about, yet rely on every day. You can find some details about this algorithm at https://www.ni.com/en-us/innovations/white-papers/06/pid-theory-explained.html, including a block diagram showing one potential implementation.

Remember The proportional integral derivative algorithm relies on a control loop feedback mechanism to minimize the error between the desired output signal and the real output signal. You see it used all over the place to control automation and automatic responses. For example, when your car goes into a skid because you brake too hard, this algorithm helps ensure that the Automatic Braking System (ABS) actually works as intended. Otherwise, the ABS could overcompensate and make matters worse.

Just about every form of machinery today uses the proportional integral derivative algorithm. In fact, robotics wouldn’t be possible without it. Imagine what would happen to a factory if all the robots constantly overcompensated for every activity they engaged in. The resulting chaos would quickly convince owners to stop using machines for any purpose whatsoever.

Creating Unique Identifiers

It seems as if everyone is just a number. Actually, not just one number — lots and lots of numbers. People’s credit cards all have a number, as do people’s driver’s license and government identifier. Likewise for all sorts of other businesses and organizations. People actually have to keep lists of all the numbers because they simply have too many to track. Yet, each of these numbers must identify the person uniquely to some party. Behind all this uniqueness are various kinds of algorithms.

Chapter 7 discusses hashes, which are one way to ensure uniqueness. Underlying both hashes and cryptography is integer factorization, a kind of algorithm that breaks really large numbers into prime numbers. In fact, integer factorization is one of the hardest kinds of problems to solve with algorithms, but people are working on the problem all the time. So much of society today depends on your ability to identify yourself uniquely that the hidden secrets of creating these identifiers is an essential part of a modern world.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.154.16