Computer Science 101 – A Series

The journey of a thousand miles begins with a single step. You have to crawl before you can run. Other proverbs. In order to become an effective computer scientist, you have to learn the basics. It's disturbing how often this is glossed over these days, but it is the truth. This series will cover a host of

CS 101 – Introduction to Logic

Computers are dumb. Computers follow very rigid patterns of logic, which we call programs. Without understanding this logic, we cannot cause a computer to perform even the simplest tasks, leaving us without the foundation for the more complicated tasks. What is logic Logic is, fundamentally, a system of rules by which we can derive certain truth. It

CS 101 – Logic Part 2

For part 1, see CS 101 - Introduction to Logic Solution to last week's problem In our last post, we considered the following problem: [code language=c] int i=0; int j=1; int k=2; int m=4; //Example 5 if( m == k * k || i == 1 && j == 1) printf("What's the result?"); [/code] It turns out that boolean (read: computer binary) logic also operates on

CS 101 – Binary and Hexadecimal

You may have heard the old programmer's joke: There are 10 kinds of people in this world: Those who understand Binary, And those who don't. This is an excellent introduction into the topic. Binary Computers, being dumb machines, are composed primarily of a host of switches. These switches have two states: ON and OFF (or CLOSED and OPEN). When the

CS 101 – Binary Mathematics

In my last post, we discovered binary as a form of numeric representation. Like decimal, we can perform basic arithmetic operations with binary (and, consequently, hex). Addition We all know that 1 + 1 = 2, right? In binary, 1 + 1 = 10, as 10 is the binary representation of 2. By the same token,

CS 101 – Bytes and ASCII

(Apologies for the relatively content-free submission, but my buffer ran dry. This is a bit of a rushed post.) We have seen that a computer represents data as binary bits. These bits are commonly grouped into eight-bit units, which we call bytes. One byte can store up to 256 possible values. These values (in this case,

CS 101 – Registers

We now have some understanding of what bits are and how we work with them, but how do we store them? Registers A register is a computer element which stores bytes of data. There are several ways to build these registers, but their core function is to hold onto data for future use. Consider the following pseudocode: a

CS 101 – Integer Representation

Apologies for the title, but I can't think of a better way to put it. Unsigned The simplest way to handle integers in binary is to treat every number as a positive number. This is called the unsigned integer representation. With the exception of subtraction, studied earlier, we have always used the unsigned integer representation before. Sign-Magnitude Naturally,

CS 101 – Floating Point Binary

This section should wrap us up on binary for now. Floating Point Numbers Up until this point, we have dealt exclusively with integer representation binary. Everything we have done has been a whole value, with no fractions. Floating point numbers are those fractions. More accurately, it is a number whose values can be between one and zero.

CS 101 – Get on the Bus

As we have discussed previously, computers operate as a huge array of switches, which operate in the on and off positions. What, we can reasonably ask, defines whether the switch is off or on? The answer: electricity. Buses: Wires connecting switches The average computer contains many hundreds of feet of wire, designed to carry electrical charges between