Category Archives: Array

Applications of Array

In this article, we are going to go through the application of an important data structure of any programming language. We are talking about arrays.  An array is a linear data structure which is used to store collection of similar type of data each of which can be accessed by using an index. The memory… Read More »

Sparse Matrix in C

In this tutorial, we are going to learn about the sparse matrix in C.  Before we start let us first discuss what a little bit about two-dimensional arrays. A matrix is represented by 2D arrays where the first index represents the number of rows and the second index represents the number of columns in the… Read More »

Why Array Indexing Starts with 0 in C?

Why array indexing starts with 0 in C, C++, Java and most of other programming languages is one of the common confusion among programmers. In this article I will tell you the reason behind it. Image Source Why Array Indexing Starts with 0 in C? Lets try to understand this by taking one example in… Read More »

C and C++ Program to Find Inverse of a Matrix

Here you will get C and C++ program to find inverse of a matrix. We can obtain matrix inverse by following method. First calculate deteminant of matrix. Then calculate adjoint of given matrix. Adjoint can be obtained by taking transpose of cofactor matrix of given square matrix. Finally multiply 1/deteminant by adjoint to get inverse.… Read More »

Program for Shell Sort in C and C++

Here you will get program for shell sort in C and C++. Shell short is an improved and efficient version of insertion sort. In this algorithm we sort the pair of elements that are far apart by gap h. The process is repeated by reducing h until it becomes 1. Program for Shell Sort in… Read More »

C/C++ Program for Union of Two Arrays

Here you will get C/C++ program to find union of two arrays. For example: First array: {1, 3, 7, 9} Second array: {1, 4, 6} Union: {1, 3, 4, 7, 6, 9}   C/C++ Program for Union of Two Arrays Union of Two Sorted Arrays If two arrays are sorted then their union can be… Read More »

C/C++ Program to Remove Duplicate Elements From Array

Here you will get C and C++ program to remove duplicate elements from array.   For example: Given Array: 5 8 9 5 12 9 New Array: 5 8 9 12 In this program I have compared each element with all other elements. If the element is equal to any other element in the array then… Read More »

Anagram in C

Here is the program for anagram in c.   Two strings are said to be anagrams if by rearranging the characters of any one string will make both strings equal.   Example: “adssfa” and “dsasfa” are anagrams “adsfa” and “sdfac” are not anagrams How to Check two Strings are Anagrams or not? So what we will… Read More »