Trees: Introduction

Trees are very useful data structures. With little effort, we can think of several situations trees are useful: think of ancestry trees, your computer file system, and how about a tree of all possible solutions to a chess game.

Definition

In their general form, trees are data structures in which data is stored in nodes. Nodes are connected together with edges.

Continue reading

Queues

Queues are dreadful in real-life when you have to wait in line for an hour or two. But in data structures, they are very useful and simple to implement.

Queues follow a very simple design concept: First-In-First-Out or FIFO. In other words, items arrive first into a queue are processed first.

Queues are useful to use as a buffers to store system input data until the system catches up and asks for more data from the queue to process.

FIFO queue featuring enqueue() and dequeue() methods

FIFO queue featuring enqueue() and dequeue() methods


Continue reading

C++: Structures, Cont’d

In a previous post we discussed how data structures can be useful in C++ to categorize relevant information together.

We implemented the following example for a driver’s license structure:

struct DriversLicense {
        int number;
        string name;
        string address;
        /**
        we'll cover DOB later 
        (hint: think of it as a struct.)
        */
} MyLicense;

Continue reading

C++: Structures

Remember our driver’s license example we discussed in an earlier post. A license holds several pieces of information:

License Number: 12345
Name: Arthur Dent
Address: Near Dean Street
Date Of Birth: 03/08/1978

When a structure is mentioned in C++ context, in fact, we are talking about a feature of the language that enables the programmer to create data structures that can represent data grouping like what you would find on a license, library card, price tag for a product, a card game card, etc.

Continue reading