17 posts

## Sorting Algorithm - Quick Sort

QuickSort is also a Divide And Conquer algorithm with a performance of \$O(n * log(n))\$, however in the worst case this becomes \$O(n^2)\$. How We start by picking an element which is called the pivot, then we will rearrange the array so that every element smaller than...

## Sorting Algorithm - Merge Sort

Merge Sort is a comparison algorithm that tries to sort the dataset by a Divide And Conquer method. The performance of this algorithm is \$O(n*log(n))\$. How We start by splitting the array up into separate elements, then we start by merging pairs together and we make sure...

## Sorting Algorithm - Insertion Sort

Insertion sort is the core algorithm to know, it is also the easiest to understand and implement. The disadvantages however are that it is horribly slow. The recommendation is to use this algorithm when you are sorting really small tables (< 10). Insertion Sort is also used as the base for...

## Sorting Algorithm - Heap Sort

Heap Sort Heap sort works by using the heap datastructure. This sorting algorithm has a performance of \$O(n*log(n))\$ which makes it fast. How Heapsort works by first creating the heap datastructure, so let's say we have an array, it will then convert this array into a heap...

## Max number with pipes in C++ and Unix

Let's say we have x children, these x children all generate a number and give this to the parent. The parent now finds the highest number and sends the children the process id of the winning child. If the winning child recognises itself then it prints that it is the...

## Creating a LinkedList with C++

Linked Lists are one of the fundamental data structures. The main usage of a Linked List is when constant insertion and deletion time is required, or when a dynamic list that can grow and shrink over time is needed. A Linked List exists out of several nodes that are linked...

## How to benchmark Reading 10MB in C++

This article is based on a vagrant Ubuntu system with an SSD so you might encounter different results. When reading and writing files in C++ it is important to use the correct buffer size or the block size. This will drastically improve the time it takes to read in files...

## Basic OOP with C++

This article is going to explain 1 example of an Object Oriented Program for C++. We will create a small program that allows us to create figures, these being: * A circle * A rectangle * A square We note that the square is a special rectangle. Then on the end when we...

You’ve successfully subscribed to Xavier Geerinck
Welcome back! You’ve successfully signed in.
Great! You’ve successfully signed up.