Читать книгу Algorithms For Dummies - John Paul Mueller, John Mueller Paul, Luca Massaron - Страница 26

Understanding a computer’s point of view

Оглавление

A computer has a simple view of data, but it’s also a view that humans typically don’t understand. For one thing, everything is a number to a computer because computers aren’t designed to work with any other kind of data. Humans see characters on the computer display and assume that the computer interacts with the data in that manner, but the computer doesn’t understand the data or its implications. The letter A is simply the number 65 to the computer. In fact, it’s not truly even the number 65. The computer sees a series of electrical impulses that equate to a binary value of 0100 0001.

Computers also don’t understand the whole concept of uppercase and lowercase. To a human, the lowercase a is simply another form of the uppercase A, but to a computer they’re two different values. A lowercase a appears as the number 97 (a binary value of 0110 0001).

If these simple sorts of single letter comparisons could cause such problems between humans and computers, it isn’t hard to imagine what happens when humans start assuming too much about other kinds of data. For example, a computer can’t hear or appreciate music. Yet, music comes out of the computer speakers. The same holds true for graphics. A computer sees a series of 0s and 1s, not a graphic containing a pretty scene of the countryside.

It’s important to consider data from the computer’s perspective when using algorithms. The computer sees only 0s and 1s, nothing else. Consequently, when you start working through the needs of the algorithm, you must view the data in that manner. You may actually find it beneficial to know that the computer’s view of data makes some solutions easier to find, not harder. You discover more about this oddity in viewing data as the book progresses.

Algorithms For Dummies

Подняться наверх