CS 101 – Flow of Code

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

CS 101 – Algorithms: Bogosorts

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) shuffle(LIST) 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

CS 101 – Algorithms

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

CS 101 – How Many Instructions Do We Really Need?

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: RISC The Reduced Instruction Set Computer (RISC) has a very small set of very basic instructions. These instructions

CS 101 – Interrupting the Flow

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. Introducing I/O When we know that we already have all the data we need to execute our program, we can just run it in one

CS 101 – Program Execution Cycle

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. Mono-Cycle Instructions We have previously discussed the concept of the clock, which is used to coordinate all operations in a

The Evil or Stupid Theory on Conspiracies

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.

CS 101 – On the Clock

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,

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