Searching and Sorting Algorithms in C

The searching Algorithm searches for the specified element in the given list. Linear search and binary search are two common search methods used to find elements in a data structure. A sorting algorithm is used to rearrange the elements of a list in a specific order. The following section contains various programs on sorting algorithms, searching algorithms, linear, and binary search algorithms. The most common sorting algorithms are selection sort, bubble sort, insertion sort, merge sort, quick sort, and heap sort algorithms.

Each sample program on searching and sorting includes a program description, C code, and program output. All examples have been compiled and tested on Windows and Linux systems.

Here is the listing of C programming examples on Searching and Sorting:

1. Searching Algorithms in C

Program Description
Search an Element in an Array in C C Program to Search an Element in an Array
Search & Replace Word with Specific Word in C C Program to Search and Replace Word with Specific Word
KMP Pattern Searching Algorithm in C C Program to Implement KMP Pattern Searching Algorithm
Searching using Self-Organizing List in C C Program to Perform Searching using Self-Organizing Lists
Interpolation Search on Array of Integers in C C program to Implement Interpolation Search on Array of Integers

2. Linear Search Algorithm in C

Program Description
Linear Search in C C Program to Implement Linear Search
Linear Search using Recursion in C C Program to Implement Linear Search using Recursion
Find Min Element of Array using Linear Search in C C Program to Find Minimum Element in an Array using Linear Search

3. Binary Search Algorithm in C

Program Description
Binary Vs Sequential Search in C C Program to Compare Binary and Sequential Search
Sequential & Binary Search Program in C C Program to Implement Sequential and Binary Search on Same Array
Uniform Binary Search in C C Program to Perform Uniform Binary Search
Binary Search using Recursion in C C Program to Perform Binary Search using Recursion
Search Sorted Array using Binary Search in C C Program to Search Sorted Array using Binary Search
Find Max Element using Binary Search in C C Program to Find Maximum Element in an Array using Binary Search
Binary Search Algorithm in C C Program to Implement a Binary Search Algorithm for a Specific Search Sequence

4. Sorting Algorithms in C

Program Description
Insertion Sort in C C Program to Implement Insertion Sort
Bubble Sort in C C Program to Implement Bubble Sort
Shell Sort Algorithm in C C Program to Implement Shell Sort Algorithm
Cyclesort in C C Program to Implement Cyclesort
CockTail Sort in C C Program to Implement CockTail Sort
Comb Sort on Array of Integers in C C Program to Implement Comb Sort Algorithm
BogoSort in C C Program to Implement BogoSort
Pigeonhole Sort in C C Program to Implement Pigeonhole Sort
LSD Radix Sort Algorithm in C C Program to Sort an Integer Array using LSDRadix Sort Algorithm
Bucket Sort in C C Program to Implement Bucket Sort
Pancake Sort in C C Program to Implement Pancake Sort
Oddeven Sort in C C Program to Implement Oddeven Sort
Bitonic Sort in C C Program to Implement Bitonic Sort
Postman Sort Algorithm in C C Program to Implement Postman Sort Algorithm
Stooge Sort Algorithm in C C Program to Implement Stooge Sort Algorithm
Shaker Sort in C C Program to Implement Shaker Sort
Sorting using Counting Sort in C C Program to Implement Counting Sort
Sort Numbers using Bubble Sort in C C Program to Sort N Numbers in Ascending Order using Bubble Sort
Shell Sort without Recursion in C C Program to Perform Shell Sort without using Recursion

5. C Algorithms on Quick Sort

Program Description
Quick Sort using Randomization in C C Program to Sort an Array using Randomized Quick Sort Technique
Quick Sort on Large Number of Elements in C C Program to Perform Quick Sort on Large Number of Elements
Quick Sort using Recursion in C C Program to Implement Quick Sort using Recursion
Quick Sort with Complexity Constraint in C C Program to Implement Quick Sort with Given Complexity Constraint
Qsort using Function Pointers in C C Program to Implement Qsort using Function Pointers

6. C Algorithms on Merge Sort

Program Description
Merge Two Sorted Array Elements in C C Program to Merge Two Sorted Array Elements
Merge and Sort Two Arrays in C C Program to Implement Merge Sort Algorithm
Merge Sort Algorithm on Linked List in C C Program to Sort Linked List using Merge Sort
Merge Sort using Recursion in C C Program to Perform Merge Sort using Recursion

7. C Algorithms on Selection Sort & Heap Sort

Program Description
Selection Sort in C C Program to Implement Selection Sort
Selection Sort Method using Functions in C C Program to Implement Selection Sort using Functions
Selection Sort using Function in C C Program to Implement Selection Sort using Recursion
Heap sort in C C Program to Implement Heap Sort
Sort Array using Heap Sort Algorithm in C C Program to Sort an Array using Heap Sort Algorithm

8. C Algorithms on Sorting

Program Description
Sort String in C C Program to Sort Word in String
Sort the Array in Ascending Order in C C Program to Sort an Array in Ascending Order
Sort the Array in Descending Order in C C Program to Sort an Array in Descending Order
Sort Names in Alphabetical Order in C C Program to Sort N Names in an Alphabetical Order
Sort Elements using Gnome Sort in C C Program to Sort the Array Elements using Gnome Sort
Sort String of Characters in C C Program to Sort the String and Remove Repeated Characters
Sort String by Removing Whitespaces and Duplicates in C C Program to Sort the String by Removing Whitespaces and Duplicates
Find Ceil and Floor Value of Sorted Array in C C Program to Find Ceiling and Floor Value of Sorted Array
Find Majority Element in an Array in C C Program to Find if a given Integer X appears more than N/2 times in a Sorted Array of N Integers
Median of Two Sorted Arrays of Different Sizes in C C Program to Find the Median of Two Sorted Arrays of Same Size

9. C Algorithms on Median & Selection

Program Description
Find kth Largest Element in Sequence in C C Program to Find kth Largest Element in a Sequence
Fibonacci Search Algorithm in C C Program to Search Sorted Sequence using Divide and Conquer
Find Second Smallest of n Elements in C C Program to Find Second Smallest of n Elements with Complexity Constraint
Find K Closest Median Elements in C C Program to Find K Closest Median Elements
Median of Two Sorted Arrays in C C Program to Find Median of Two Arrays of Different Sizes
Locality of Reference in Link List in C C Program to Implement Locality of Reference in Link List
Finite State Automaton based Search in C C Program to Perform Finite State Automata based Search