Checking for Palindrome Strings or Numbers in C Language

In this programming algorithm tutorial we will look at how to find out if a string or number is a palindrome or not. A palindrome is a word, phrase, number or other sequence of units that has the property of reading the same in either direction. A few examples of palindrome strings are: “madam”, “dad” and “radar”. More »


Posted in Programming Algorithms | 5 Comments


Linear Search Algorithm in C Language

In this programming algorithm tutorial we will at how we can do a linear search in C language. A linear search algorithm using numbers is very easy to implement. More »


Posted in Programming Algorithms | 2 Comments


Determining the Area of Different Shaped Triangles in C

In this C programming algorithm tutorial we are looking at how to implement the mathematical formulas to determine area of different shaped triangles. We will look at the triangle, right angled triangle and equilateral triangle. We will give you the formula, the C source code and the results. More »


Posted in Programming Algorithms | 0 Comments


Area of a Rectangle Circle and Trapezium in C

In this C programming algorithm tutorial we are looking at how to implement the mathematical formulas to determine area of a rectangle, circle and trapezium. We will give you the formula, the C source code and the results. More »


Posted in Programming Algorithms | 2 Comments


How to Print Floyds Triangle in C

In this tutorial we will take a quick look at the Floyd’s triangle using the C language. The Floyd’s triangle (named after Robert Floyd) algorithm is a right-angled triangular array of natural numbers. It is defined by filling the rows of the triangle with consecutive numbers, starting with the number one in the top left corner. More »


Posted in Programming Algorithms | 10 Comments


Printing a Diamond Pattern in C

In this tutorial we are looking at how to print a diamond pattern using the C language. The diamond pattern algorithm question is often used in C courses, so it make sense that we also take a look at it. More »


Posted in Programming Algorithms | 9 Comments


Cocktail Sort Algorithm or Shaker Sort Algorithm

In this tutorial we look at another sorting algorithm named cocktail sort. Cocktail sort is a slight variation of bubble sort. More »


Posted in Programming Algorithms | 2 Comments


Exclusive-OR (XOR) Encryption

Exclusive-OR (XOR) encryption is an encryption method that is hard to break through with so called “brute force” methods (brute force = using random encryption keys in the hope you find the correct one.), but the encryption method is susceptible to pattern recognition. Patterns can be easily avoided by first compressing the file (compression already makes it unreadable, it removes patterns for you) before it is encrypted. More »


Posted in Programming Algorithms | 1 Comment


Shell Sort Algorithm

An inventor called DL Shell came up with a very interesting sort which he called shell sort. This sorting algorithm is almost similar to the bubble sort algorithm. The shell sort compares elements that are a certain distance away (d positions away) from each other and it compares these elements repeatedly (bubble sort only compares adjacent elements.) It uses the equation d = (n + 1) / 2. More »


Posted in Programming Algorithms | 17 Comments


Insertion Sort Algorithm

The insertion sort only passes through the array once. Therefore it is a very fast and efficient sorting algorithm with small arrays. (The efficiency is lost however with large amounts of data.)

The sort works as follows: the array is split into two (virtual) sub-arrays. (With virtual I mean that the array is not really split.) The first sub-array is considered to be the “sorted array”. The elements of the second sub-array will be inserted into the first sub-array at the right position. More »


Posted in Programming Algorithms | 0 Comments