CS Review: Merge Sort

Merge sort is among the divide and conquer algorithms. That is to say, it divides the input array into half, calls itself on both halves. This process is done recursively over the entire array. When we’re done, all the individually sorted pieces are merged back together to form the fully sorted array. A Closer Look at the Functionality Merge sort can be a bit hard to wrap your head around when you first hear it, so let’s take a look at how the process looks on an example array....

February 28, 2021 · 4 min · Adam Thompson

CS Review: Quicksort

Quicksort is another one of the divide and conquer sorting algorithms. It works by partitioning the array around some chosen pivot point, which there are a few different ways to choose. Quicksort is generally preferred over merge sort for sorting arrays due to the fact that the general form of the algorithm sorts in-place. How Quicksort Works As has already been mentioned, quicksort partitions your array of data based on some pivot point....

February 28, 2021 · 4 min · Adam Thompson

CS Review: Bubble Sort

Bubble sort is the easiest possible sorting algorithm you could imagine. It works by simply iterating over an array of data and comparing adjacent items. If those items are in the wrong order, then they are swapped. In doing this, the largest items “bubble up” to the correct position in the array (assuming ascending order, anyway). While this is great from a simplicity standpoint, it’s a pretty awful solution in terms of efficiency....

February 27, 2021 · 2 min · Adam Thompson

CS Review: Selection Sort

The previous sorting algorithm we took a look at was bubble sort. This time around we will be taking a look at selection sort, which is slightly more complex than bubble sort, but only by a tiny bit. The idea behind selection sort is that you keep iterating over your array of data, finding the minimum element each time and placing it at the start of the list. In this way, you can think of selection sort as managing two subarrays: the portion of the array that is sorted and the portion that still needs to be sorted....

February 27, 2021 · 2 min · Adam Thompson

A Review of Binary Search Trees

My previous computer science review post took a look at the tree data structure. This time around we will be exploring a specific kind of binary tree: The Binary Search Tree. Let’s not waste any more time and just jump right in! What is a Binary Search Tree? A Binary Search Tree (BST) is a binary tree such that the following holds true: The left sub-tree contains only nodes whose values are less than the parent’s value....

February 26, 2021 · 4 min · Adam Thompson

A Review of Graphs

You may have noticed that I’ve been putting a lot more work into writing posts for my Computer Science Review series lately. The last installment of this series took a look at binary search trees. This time around we will be taking some time to review one of my favorite data structures: Graphs. What is a Graph? If you look at the formal definition of a graph, such as the one that you might get in a discrete mathematics course, you’ll get something along these lines: A graph is an ordered triple (N, A, g) where N is a nonempty set of nodes or vertices, A is a set of arcs or edges, and g is a function associating each arc a with an unordered pair {x, y} of nodes....

February 26, 2021 · 11 min · Adam Thompson

A Review of Binary Trees

In my previous review series, I wrote a brief review of set theory. This time around we’ll take a look at the binary tree data structure. The tree structure is very common, incredibly useful data structure in the field of computer science and it’s essential that any engineer understand how they work. The Tree Data Structure A tree, unlike some other data structures, such as an array, linked list, stack, or queue, is a hierarchical data structure....

February 25, 2021 · 13 min · Adam Thompson

A Brief Review of Set Theory

Set theory is the branch of mathematics that, unsurprisingly, deals with sets. It’s an area of great importance in a number of fields, including computer science. In this post, I’ll go over a brief review of basic set theory as it pertains to those pursuing an interest in computer science. Let’s just jump right in! What is a Set? The first and most logical question we can answer about set theory is just what is a set?...

January 11, 2021 · 14 min · Adam Thompson

The Dining Philosophers Problem

The dining philosophers problem is a classic problem in the realm of computer science. If you’ve had any formal CS education you’ve more than likely seen the problem when learning about concurrent programming. Today we will take a look at the problem and look at an example of how we can solve it. The Problem Suppose you had a round table with five silent philosophers sat around the table. Between each pair of adjacent philosophers is a chopstick (so, 5 total chopsticks) and there is a bowl of rice in the center of the table....

August 21, 2020 · 7 min · Adam Thompson

Boolean Algebra Cheat Sheet

I previously posted a logic rules cheat sheet and figured it was about time that I do the same for boolean algebra. Expression Equivalent To Name of the Rule $$X + Y$$ $$Y + X$$ Commutative $$X \cdot Y$$ $$Y \cdot X$$ Commutative $$(X + Y) + Z$$ $$X + (Y + Z)$$ Associative $$(X \cdot Y) \cdot Z$$ $$X \cdot (y \cdot Z)$$ Associative $$X + (Y \cdot Z)$$ $$(X + Y) \cdot (Z + Z)$$ Distributive $$X \cdot (Y + Z)$$ $$(X \cdot Y) + (X \cdot Z)$$ Distributive $$X + 0$$ $$X$$ Identity $$X \cdot 1$$ $$X$$ Identity $$X + X'$$ $$1$$ Complement $$X \cdot X'$$ $$0$$ Complement $$X + X$$ $$X$$ Idempotence $$X \cdot X$$ $$X$$ Idempotence

April 20, 2020 · 1 min · Adam Thompson