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?”
Tag: Sorting
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 an efficient, general-purpose sorting algorithm. Unlike bubble sort or insertion sort, it is usable in most practical cases. Merge sort implementation is based on divide and conquer algorithm. Here we’ll see how to implement merge sort in C programming language. And also we’ll analyze its performance in various conditions. Merge Sort Algorithm … Continue reading “How to Implement Merge Sort in C?”
Implement Bubble Sort in C
Bubble Sort is the most popular sorting algorithm that most programmers start with. Even though its performance is not good enough for most practical cases, it is much simpler than other efficient sorting algorithms like quick sort or merge sort. Bubble Sort Algorithm Bubble sort is to continuously swap two adjacent elements if they are … Continue reading “Implement Bubble Sort in C”
How to Implement Insertion Sort in C Programming?
Insertion sort is very popular sorting algorithms because of its simplicity. Its performance is not as good as quicksort or shellsort for large array but it is very simple like bubble sort. It is often used for less number of elements especially when the array is substantially sorted. Here we’ll see how to implement insertion sort in … Continue reading “How to Implement Insertion Sort in C Programming?”