# C Programming Examples on Combinatorial Problems & Algorithms

## 1. C Programming examples on “Sorting”

Sorting is ordering a list of objects. Radix sort is a non-comparative integer sorting algorithm that sorts data with integer keys by grouping keys. Bubble Sorting algorithm works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. Heapsort is a comparison-based sorting algorithm to create a sorted array. This section contains C programs on implementing internal sorting algorithms like bucket sort, bubble sort, insertion sort, selection sort, heapsort and mergesort. this section also provides implementation on other sorting like radix, stooge, shaker, quick and shell sort.

C Program to Implement Radix Sort C Program to Implement Bucket Sort C Program to Implement Bubble Sort C Program to Implement Selection Sort C Program to Implement Quick Sort Using Randomization C Program to Implement Shell Sort Algorithm C Program to Implement Heap sort C Program to Implement Sorting of Less than 100 Numbers in O(n) Complexity C Program to Perform Sorting Using B-Tree C Program to Perform Quick Sort on Large Number of Elements C Program to Implement Merge Sort Algorithm on Linked List C Program to Implement Counting Sort C Program to Perform the Sorting Using Counting Sort C Program to Perform the Shaker Sort C Program to Perform Stooge Sort Algorithm |

## 2. C Programming examples on “Searching”

Searching is an operation that helps to finds the place of a given element or value in the list. Most commonly used searching technique are linear search or sequential search and binary search. The C programs in this section implements searching algorithms like binary search interpolation algorithms. The other programs in this section to find the largest element, minimum and maximum number in an array or sequence using linear and binary search.

C Program to Compare Binary and Sequential Search C Program to Perform Searching Using Self-Organizing Lists C Program to Implement a Binary Search Algorithm for a Specific Search Sequence C Program to Search for an Element in a Binary Search Tree C Program to Implement Multi-Threaded Version of Binary Search Tree C Program to Perform Searching Based on Locality of Reference C Program to Implement Interpolation Search Algorithm C Program to Find kth Largest Element in a Sequence C Program to Search Sorted Sequence Using Divide and Conquer with the Aid of Fibonacci Numbers C Program to Perform Uniform Binary Search C Program to Find Minimum Element in an Array using Linear Search C Program to Find Maximum Element in an Array using Binary Search |

## 3. C Programming examples on ” Median and Selection”

The C programs in this section to find largest element, smallest number and median using binary search approach and order statistic algorithm. It Computes median and mode of different elements in an array, find data set modes and implementation of quick sort with given complexity constraint.

C Program to Find Second Smallest of n Elements with Given Complexity Constraint C Program to Implement Quick Sort with Given Complexity Constraint C Program to List the kth Quantiles of a Set within Given Time Constraint C Program to Find k Numbers Closest to Median of S, Where S is a Set of n Numbers C Program to Find Median of Elements where Elements are Stored in 2 Different Arrays C Program to Find ith Largest Number from a Given List Using Order-Statistic Algorithm C Program to Find kth Smallest Element by the Method of Partitioning the Array C Program to Find the Mode in a Data Set |

## 4. C Programming examples on “Generating Permutations”

The C programs in this section deals with the implementation of heaps and alexander bogomolny’s unordered permutation algorithm. program to generate all possible combinations of lists and numbers. The other programs in this section to find number of permutations in a given string.

C Program to Implement the Alexander Bogomolny’s UnOrdered Permutation Algorithm for Elements From 1 to N C Program to Permute All Letters of an Input String C Program to Implement Heap’s Algorithm for Permutation of N Numbers C Program to Generate All Possible Combinations of a Given List of Numbers C Program to Generate a Sequence of N Characters for a Given Specific Case |

## 5. C Programming examples on “Generating Subsets”

Gray code is an ordering of the binary numeral system such that two successive values differ in only one bit. This section contains C program to generate subsets in gray code and lexico graphic order, random and all possible subsets by coin flipping and k elements. The other programs deals with implementation of binary counting method.

C Program to Generate All Subsets of a Given Set in the Gray Code Order C Program to Generate All Subsets of a Given Set in the Lexico Graphic Order C Program to Implement the Binary Counting Method to Generate Subsets of a Set C Program to Generate a Random Subset by Coin Flipping C Program to Generate All Possible Subsets with Exactly k Elements in Each Subset C Program to Generate All Possible Combinations Out of a,b,c,d,e C Program to Generate All Pairs of Subsets Whose Union Make the Set C Program to Generate All Sequences out of a Binary Sequence without Altering 0 Positions while Changing 1 |

## 6. C Programming examples on “Generating Partitions”

The C programs in this section generates integer partitions, random partitions and performs operations on numbers. It also contains programs on finding the ways to write a numbers.

C Program to Perform Integer Partition for a Specific Case C Program to Generate All the Set Partitions of n Numbers Begining from 1 and so on C Program to Generate Random Partition out of a Given Set of Numbers or Characters C Program to Find the Number of Ways to Write a Number as the Sum of Numbers Smaller than Itself |

## 7. C Programming examples on “Generating Graphs”

Adjacency matrix is a square matrix used to represent a finite graph. Linked list is a data structure that consists of sequence of nodes. Each node consists of two fields they are data field and reference field. This section contains C programs on generating graphs using adjacency matrix, incidence matrix, 2d arrays, linked lists, adjacency and incidence list, random undirected graph and random directed acyclic graph, program to create prufer code for trees and random graph using random edge generation.

C Program to Generate a Random UnDirected Graph for a Given Number of Edges C Program to Generate a Random Directed Acyclic Graph DAC for a Given Number of Edges C Program to Create a Random Graph Using Random Edge Generation C Program to Construct a Random Graph by the Method of Random Edge Selection C Program to Construct a Random Graph by the Method of Preferencial Attachment C Program to Create the Prufer Code for a Tree C Program to Generate a Graph for a Given Fixed Degree Sequence C Program to Generate a Semi-Random Collection of Graphs by Using the Technique of Edge-Flipping C Program to Check if any Graph is Possible to be Constructed for a Given Degree Sequence C Program to Represent Graph Using Adjacency Matrix C Program to Represent Graph Using Incidence Matrix C Program to Represent Graph Using Adjacency List C Program to Represent Graph Using Incidence List C Program to Represent Graph Using 2D Arrays C Program to Represent Graph Using Linked List |

**Here’s the list of 1000 C Algorithms, Problems & Programming Examples.**