Java Sets

Java has two different types of sets, Unsorted and Sorted… even if Math Sets are technically unsorted. Unsorted Sets Unsorted sets in Java are not a class that can be defined. Therefore you need to use the HashSet and then use the polymorphic nature of the OOP to create the set. From here, you want…

Binary Trees

A binary tree is often the easiest type of tree structure to build because it has at most two child nodes. We usually call these child nodes left and right. We add a top node, our first value. The first value is always at the top – and is a special case when creating the…

Priority Queues

In the real world, while we might say we’re using a queue, there are those who can, and will, skip ahead of members already in the queue. Now, I’m not talking about skipping ahead of a person, like a line skipper in elementary school. A simple example you might think of using a queue, is…

How Queues Work

A queue is a fairly common data storage method. However, unlike many methods of storing data, where we keep the data for the entire runtime of a function or even the entire application, a queue’s data is designed to be consumable. That is, at some point data will enter the queue, and then it will…

Stacks in Computers

Stacks don’t have as much use in computers as a queue, however, when you need to use one, they are very beneficial. Two of the most common uses of stacks are to help with Expression Conversion (Infix to Postfix, Postfix to Prefix, etc.) and especially with the parsing of data.  When parsing source files before…

Double Linked List

Now one issue that linked lists have is that while it’s really easy to move to the next element in your list, moving backwards to find the previous item is really challenging. You literally have to start back at the beginning and move through every element, until you reach the one before where you just…