
P1: GIG PE002-01drv PE002-Harel PE002-Harel-v4.cls February 25, 2004 14:38 C H A P T E R 1 Introduction and Historical Review Though thy beginning was small, yet thy end will be very or, What’s It All About? great JOB 8: 7 Computers are amazing machines. They seem to be able to do anything. They fly aircraft and spaceships, and control power stations and hazardous chemical plants. Companies can no longer be run without them, and a growing number of sophisti- cated medical procedures cannot be performed in their absence. They serve lawyers and judges who seek judicial precedents in scores of documented trials, and help scientists in performing immensely complicated and involved mathematical com- putations. They route and control millions of telephone calls in networks that span continents. They execute tasks with enormous precision—from map reading and typesetting to graphical picture processing and integrated circuit design. They can relieve us of many boring chores, such as keeping a meticulous track of home ex- penses, and at the same time provide us with diverse entertainment such as computer games or computerized music. Moreover, the computers of today are hard at work helping design the even more powerful computers of tomorrow. It is all the more remarkable, therefore, that the digital computer—even the most modern and complex one—can be thought of as merely a large collection of switches. These switches, or bits as they are called, are not “flipped” by the user, but are special, internal switches that are “flipped” by the computer itself. Each bit can be in one of two positions, or, to put it another way, can take on one of two values, 0 or 1. Typically, the value of a bit is determined by some electronic characteristic, such as whether a certain point has a positive or a negative charge. A computer can directly execute only a small number of extremely trivial opera- tions, like flipping, zeroing, or testing a bit. Flipping changes the bit’s value, zeroing makes sure that the bit ends up in the 0 position, and testing does one thing if the bit is already in the 0 position, and another if it is not (see Figure 1.1). Computers may differ in size (according to the number of available bits), in the types of elementary operations they can perform, in the speed in which these operations are performed, in the physical media that embody the bits and their internal organization, and, significantly, in their external environment. This last item means that two computers, which are otherwise similar in function, might seem very 3 P1: GIG PE002-01drv PE002-Harel PE002-Harel-v4.cls February 25, 2004 14:38 4 I. Preliminaries Figure 1.1 if this bit Operations on bits. flip this bit zero this bit is 1, flip this bit 01011 01011 01011 if this bit flip this bit zero this bit is 1, flip this bit 01001 01001 01011 01101 01001 11011 Flipping Zeroing Testing different to an observer: one might resemble a television set with a keyboard, while the other might be buried under the dials and knobs of an automatic knitting machine. However, the outward appearance is of peripheral importance when compared to the bits and their internal arrangement. It is the bits that “sense” the external stimuli arriving from the outside world via buttons, levers, keys on a keyboard, electronic communication lines, and even microphones and cameras. It is the bits that “decide” how to react to these stimuli and respond accordingly by directing other stimuli to the outside via displays, screens, printers, loudspeakers, beepers, levers, and cranks. How do the computers do it? What is it that transforms such trivial operations on bits into the incredible feats we see computers perform? The answer lies in the central concepts of this book: the process, and the algorithm that prescribes it and causes it to take place. I Some Gastronomy Imagine a kitchen, containing a supply of ingredients, an array of baking utensils, an oven, and a (human) baker. Baking a delicious raisin cake is a process that is carried out from the ingredients, by the baker, with the aid of the oven, and, most significantly, according to the recipe. The ingredients are the inputs to the process, the cake is its output, and the recipe is the algorithm. In other words, the algorithm prescribes the activities that constitute the process. The recipes, or algorithms, rel- evant to a set of processes under discussion are generally called software, whereas utensils and oven represent what is generally known as hardware. The baker, in this case, can be considered a part of the hardware (see Figure 1.2). As in the case of bit operations, the baker/oven/utensils constellation has very limited direct abilities. This cake-baking hardware can pour, mix, spread, drip, light the oven, open the oven door, measure time, or measure quantities but cannot directly bake cakes. It is the recipes—those magical prescriptions that convert the limited abilities of kitchen hardware into cakes—and not ovens or bakers, that are the subject of this book. P1: GIG PE002-01drv PE002-Harel PE002-Harel-v4.cls February 25, 2004 14:38 1. Introduction and Historical Review 5 Figure 1.2 Baking a cake. ingredients (software) (hardware) oven recipe utensils baker cake Recipes, as just mentioned, are called algorithms here, while the area of human study, knowledge, and expertise that concerns algorithms will be termed algorith- mics in this book. The analogy drawn here has been made as exact as possible: the recipe, which is in a sense an abstract entity, is the algorithm; the formal written ver- sion of the recipe, such as the one found in a cookbook, is analogous to a computer program. Software actually refers more to programs—precise representations of algorithms written in special computer-readable languages—than to the algorithms themselves. However, until we discuss programming languages in Chapter 3, this distinction is quite immaterial. We confront algorithms wherever we go. Many everyday processes are governed by algorithms: changing a flat tire, constructing a do-it-yourself cabinet, knitting a sweater, dividing numbers, looking up a telephone number, updating a list of expenses, or filling out an income tax form. Some of these (division, for example) might be more immediately related in our minds to computers, than others (cabinet construction, for example), but this is of less concern to us here. Although computers are fundamental to the topic of this book, we shall not concentrate on their physical aspects at all, except implicitly in parts of Chapters 3 and 9. It is with their spirit that we are concerned; with the recipes that make them tick—with their algorithms. I Algorithmics vs. Computer Science Algorithmics is more than a branch of computer science. It is the core of computer science, and, in all fairness, can be said to be relevant to most of science, business, and technology. The very nature of algorithmics renders it particularly applicable to those disciplines that benefit from the use of computers, and these are fast becoming an overwhelming majority. P1: GIG PE002-01drv PE002-Harel PE002-Harel-v4.cls February 25, 2004 14:38 6 I. Preliminaries People have been known to ask: “What really is computer science? Why don’t we have submarine science, dishwasher science, or telephone science?” Telephones and dishwashers, it might be argued, are as important to modern life as computers are; perhaps more so. A slightly more focussed question is whether computer science is subsumed by such classical disciplines as mathematics, physics, neuro-science, electrical engineering, linguistics, logic, and philosophy. This book does not attempt to answer these questions. It is hoped, however, that the book will implicitly convey something of the uniqueness and universality of algorithmics, and hence something of the importance of computer science as an autonomous—albeit, young—field of study. Since computers could conceivably re- strict the generality of algorithmics, some people view the unavoidable link between the two as unfortunate. In fact, terming the field “computer science,” someone once said, is like referring to surgery as “knife science.” Be that as it may, it is clear that algorithmics would never have developed the way it has without that link. However, it is generally agreed that the term “computer science” is misleading, and that some- thing like “information science,”“process science,” or “the science of the discrete” might be better. Again, we only claim that our subject matter, algorithmics, forms the underpinnings of computer science, not that it replaces it. Some of the topics we discuss in the sequel, such as the existence of problems that computers cannot solve, have philosophical implications, not only on the limits of the wonderful machines we are able to build, but also on our own limits as mortals with finite mass and a finite life span. The profound nature of such implications notwithstanding, the emphasis in this book is on the more pragmatic goal of acquiring a deep understanding of the fundamentals of machine-executable processes, and the recipes, or algorithms, that govern them. II I Some History Let us now review several important milestones in the development of computers and computer science, mainly to illustrate that as an orderly scientific discipline the field is extremely young. Somewhere between 400 and 300 B.C., the great Greek mathematician Euclid invented an algorithm for finding the greatest common divisor (gcd) of two positive integers. The gcd of X and Y is the largest integer that exactly divides both X and Y . For example, the gcd of 80 and 32 is 16.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages15 Page
-
File Size-