How to Implement Shell Sort in C Programming?

Shell Sort (aka shellsort) can be thought as an improvement over insertion sort. To understand shell sort, we have to recall how insertion sort works. In insertion sort at any moment, the whole array is sub-divided in two sections, one is sorted and another is not. One element is picked from the unsorted section and compares with the … Continue reading “How to Implement Shell Sort in C Programming?”

How to Implement Quick Sort in C?

Quick Sort is an efficient sorting algorithm developed by Tony Hoare in 1959. It is still a commonly used sorting algorithm in most practical cases. If implemented properly, it is two or three times faster than other efficient sorting algorithms like merge sort or heap sort. Here we’ll see how to implement this sorting algorithm … Continue reading “How to Implement Quick Sort in C?”

How to Implement Merge Sort in C?

Merge sort is efficient, general-purpose sorting algorithm. Unlike bubble sort or insertion sort, it is usable in most practical cases. Merge sort is divide and conquer algorithm. Here we’ll see how to implement merge sort in C programming language. We’ll also analyze its performance in various conditions. Merge Sort Algorithm Merge sort is divide and … Continue reading “How to Implement Merge Sort in C?”

How to Implement Bubble Sort in C Programming?

Bubble Sort is very popular sorting algorithm. Its popularity is not because of its performance but because of its simplicity. In fact bubble sort is not suitable for most of the practical cases because of its inefficiency. But it very easy to understand and code compare to other sorting algorithms like quick sort or merge sort. … Continue reading “How to Implement Bubble Sort in C Programming?”

How to Implement Insertion Sort in C Programming?

Insertion sort is one of the most popular sorting algorithms. Its popularity is not because of its performance but for its simplicity. Its performance is not as good as quicksort or shellsort for large number of inputs but it is very simple like bubble sort. It is often used for less number of elements especially when the … Continue reading “How to Implement Insertion Sort in C Programming?”

How to Parse and Print XML File in Tree Form using libxml2 in C Programming?

Here we’ll see how to write C program to print XML file on the screen. XML file is widely used to store and transport data over internet. Parsing and using the data from an XML file is basic programming requirement. Format of XML file Before jumping into the code, it is important to understand the basic format … Continue reading “How to Parse and Print XML File in Tree Form using libxml2 in C Programming?”

How to Remove Duplicate Entries from Sorted Linked List using C Programming

Here we’ll see how to remove duplicate entries from sorted Linked List using C Programming. In the previous article we saw how to remove duplicate entries from a generic linked list which will work here for sorted linked list also. But we’ll see how to take advantage of the sorted list and improve the performance … Continue reading “How to Remove Duplicate Entries from Sorted Linked List using C Programming”

How to Remove Duplicate Entries from Linked List in C Programming?

Here we’ll see how to write C program to remove duplicate entries from linked list. Duplicate entry means nodes with same value appear multiple times in the list. Linked list in the diagram above contains duplicate entries, 43, 24 and 5 appeared twice. We’ll write a program to remove these duplicate elements such that they appear … Continue reading “How to Remove Duplicate Entries from Linked List in C Programming?”

When to Prefer Linked List over Array in C?

As a C programmer when we need to deal with multiple data elements of same type, we think of using array or linked list. Many times we get confused which data structure we should go for. Array or linked list? Though Array and linked list have some similarities, they are two fundamentally different data structures. … Continue reading “When to Prefer Linked List over Array in C?”

How to Implement Singly Linked List in C?

What is singly linked list? In computer science, linked list is a collection of data elements, also called nodes, which are connected or linked by means of pointers or references. Connected or linked means if you have access to an element, you can go to the next element. In Singly linked list the links are unidirectional. … Continue reading “How to Implement Singly Linked List in C?”