# 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 – 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

# 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 – 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 – 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 – 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 – 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 – Recursion and Iteration

Many problems in this world require us to perform a series of steps over and over, looking for the correct result. In computer programming, we have three ways to do this. Keep it Simple Of course, if you really want to make this easy for yourself, you just write the solution as one big block. This

# CS 101 – Evolution of Programming

Programming makes our lives easier, but most people don't fully understand how much easier. Programming began with gears That's right, folks. Long ago, when you wanted to do math quickly, you had to use something like an abacus or slide rule. Sure, you had geniuses like Babbage with his mechanical adding machine, but these were very

# CS 101 – Life Cycle of a Program

Programs go through a variety of stages on the way to execution. Depending on the type of language, some steps may be added or removed to the list, but here are the stages for a compiled language like C. Problem All programs start with a problem which needs to be solved. This problem could be as