# C Programming Code Examples

## C > Sorting Searching Code Examples

C program code to 2d example insertion sort [linked list]. Insert a node directly at the right place in the linked list. Insert some numbers into the linked list. Print the list. Free the list

If the list is empty, create first node. Go to last node. Add node at the end. Preform a bubble sort on the linked list. The 'c' node precedes the 'a' and 'e' node pointing up...

'Insertion Sort Algorithm' picks elements one by one & places it to the right position where it belongs in the "Sorted List of Elements". In C program we have "implemented the same"

C program, using iteration, performs a Depth First Search traversal. Depth-first search DFS is an algorithm for 'Traversing or Searching a Tree', tree structure or graph. The concept of

C Program accepts the sorted array and does search using "Binary Search". Binary search is algorithm for locating the position of an item in a 'Sorted Array'. A search of sorted data, in

C Program to Arrange numbers in Ascending order. Code 'prompts user' for the n numbers, once the user is done entering those numbers and this c program sorts and displays them in

Compare and swap based on dir, sorts bitonic sequence in ascending order dir=1, otherwise in descending order. Code generates "Bitonic Sequence" by Sorting Recursively two halves

C Code to check if the "array is sorted" or not. Shuffle the "Array Elements" and check if the array is sorted or not & if not sorted calls the shuffle function to shuffle the array elements

C Program implements cocktail sort. Cocktail sort is a variation of bubble sort that is both a stable sorting algorithm & a comparison sort. The algorithm differs from a "Bubble Sort" in

C Program implements 'Cyclesort'. Cycle sort is an in-place, unstable 'Sorting Algorithm', a comparison sort that is theoretically optimal in terms of the total number of writes to the

C implements 'Linear Search'. Linear search is also called as sequential search. Linear search is a method for Finding a Particular value in a list, that consists of checking every one of its

C code implements Pancake Sort on array of integers. Pancake sorting is a variation of the "Sorting Problem" in which the only allowed operation is to reverse the elements of some

Code implement pigeonhole sort. Pigeonhole sorting, also known as count sort, is a sorting algorithm that is suitable for 'Sorting Lists' of elements where the Number of Elements (n)

C Program implements selection sort method using functions. 'Selection' Sort is among the simplest of Sorting Techniques. Lets first find the smallest in the array and exchange it with

This C Program implements a Selection Sort. 'Selection Sort' works by finding the smallest unsorted item in the list and swapping it with the item in the current position. It is used for

C program, using recursion, 'Performs Merge' sort. A Merge Sort is a sorting algorithm with 'Complexity of O(nlogn)'. It is used for sorting numbers, structure, files. Perform Merge Sort

C program, Using Recursion, performs binary search. In this C program, an array of random number is generated. User is asked to enter a key. The array of random numbers are sorted

C Program to performs Comb sort on array of integers. "Comb Sort" is a comparison sorting algorithm. This sort is 'Exchange sort', similar to 'Bubble Sort'. Function to find the new gap

C program to using recursion, performs quick sort. A 'Quick Sort' is a sorting algorithm with 'complexity of O(nlogn)'. It is used for sorting Numbers, Structure, Files. Enter the number

Page 1 Page 2