Double-length post tomorrow, I guess. I let my buffer run
Programs are composed of algorithms - recipes for completing simple tasks. The steps used to compose an algorithm can be classified into sequences and decisions.
Sequences and Decisions
A sequence of instructions is a step-by-step flow, with only one possible path. These are the meat of the code, as these do the heavy lifting.
A decision is
A few fun algorithms, all of which are patently slow.
Bogosort - Theoretically, if we randomly shuffle the elements in our list, they will eventually be sorted.
while(LIST not sorted)
Bogobogosort - This is a slower bogosort, if you can believe it. Every time we fail to sort part of the list, we start over at the
Programs are essentially computer recipes - a series of steps and ingredients (variables) which produces a result. However, when dealing with large problems, we have to create larger and larger recipes. This is why we break down individual solutions into processes we call algorithms.
Algorithm - An Overview
An algorithm is a step-by-step solution to a
As we learned earlier, programs are broken into assembly instructions, which are executed one-at-a-time. The question which naturally arises is what constitutes an instruction, and how many instructions we actually need.
There are two major categories of instruction sets:
The Reduced Instruction Set Computer (RISC) has a very small set of very basic instructions. These instructions
We have already discussed the fact that a program is a series of instructions executed in a particular order. This is mostly correct, but it's a bit more complicated than that.
When we know that we already have all the data we need to execute our program, we can just run it in one
In simple terms, a program is a series of instructions to be executed in a particular order. The program execution cycle is a method by which we attempt to improve the speed of this execution series.
We have previously discussed the concept of the clock, which is used to coordinate all operations in a
Editor's note: This is about as close to a conspiracy theory as I care to share with most people. Take that as you will.
When I say conspiracy theory, your thoughts immediately turn to 9/11 truthers, birthers, and alien enthusiasts. If you are particularly nerdy, they may turn to your favorite episode of the X-Files.
In my last post, I alluded to the topic of this post. Sorry about that. I usually like to lay the groundwork and build on it, but I got a bit carried away. In best practice, we should avoid leaning on information we have not yet provided.
Static and Dynamic
Before we can discuss the clock,
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