C/C++ Programs

Array C/C++ Programs

C Program to find sum of elements in a given array

C program to find largest element in an array

Recursive C program to linearly search an element in a given array

C program to multiply two matrices

C/C++ Program for Given an array A[] and a number x, check for pair in A[] with sum as x

C/C++ Program for Majority Element

C/C++ Program for Find the Number Occurring Odd Number of Times

C/C++ Program for Largest Sum Contiguous Subarray

C/C++ Program for Find the Missing Number

C/C++ Program for Search an element in a sorted and pivoted array

C/C++ Program for Merge an array of size n into another array of size m+n

C/C++ Program for Median of two sorted arrays

C/C++ Program for Write a program to reverse an array

C/C++ Program for Program for array rotation

C/C++ Program for Reversal algorithm for array rotation

C/C++ Program for Block swap algorithm for array rotation

C/C++ Program for Maximum sum such that no two elements are adjacent

C/C++ Program for Leaders in an array

C/C++ Program for Sort elements by frequency | Set 1

C/C++ Program for Count Inversions in an array

C/C++ Program for Two elements whose sum is closest to zero

C/C++ Program for Find the smallest and second smallest element in an array

C/C++ Program for Check for Majority Element in a sorted array

C/C++ Program for Maximum and minimum of an array using minimum number of comparisons

C/C++ Program for Segregate 0s and 1s in an array

C/C++ Program for k largest(or smallest) elements in an array | added Min Heap method

C/C++ Program for Maximum size square sub-matrix with all 1s

C/C++ Program for Maximum difference between two elements such that larger element appears after the smaller number

C/C++ Program for Union and Intersection of two sorted arrays

C/C++ Program for Floor and Ceiling in a sorted array

C/C++ Program for A Product Array Puzzle

C/C++ Program for Segregate Even and Odd numbers

C/C++ Program for Find the two repeating elements in a given array

C/C++ Program for Sort an array of 0s, 1s and 2s

C/C++ Program for Find the Minimum length Unsorted Subarray, sorting which makes the complete array sorted

C/C++ Program for Find duplicates in O(n) time and O(1) extra space

C/C++ Program for Equilibrium index of an array

C/C++ Program for Which sorting algorithm makes minimum number of memory writes?

C/C++ Program for Turn an image by 90 degree

C/C++ Program for Search in a row wise and column wise sorted matrix

C/C++ Program for Next Greater Element

C/C++ Program for Check if array elements are consecutive | Added Method 3

C/C++ Program for Find the smallest missing number

C/C++ Program for Count the number of occurrences in a sorted array

C/C++ Program for Binary Search

C/C++ Program for Selection Sort

C/C++ Program for Bubble Sort

C/C++ Program for Insertion Sort

C/C++ Program for Merge Sort

C/C++ Program for Heap Sort

C/C++ Program for QuickSort

C/C++ Program for Given an array arr[], find the maximum j – i such that arr[j] > arr[i]

C/C++ Program for Maximum of all subarrays of size k (Added a O(n) method)

C/C++ Program for Find whether an array is subset of another array | Added Method 3

C/C++ Program for Find the minimum distance between two numbers

C/C++ Program for Find the repeating and the missing | Added 3 new methods

C/C++ Program for Print a given matrix in spiral form

C/C++ Program for A Boolean Matrix Question

C/C++ Program for Median in a stream of integers (running integers)

C/C++ Program for Find a Fixed Point in a given array

C/C++ Program for Maximum Length Bitonic Subarray

C/C++ Program for Find the maximum element in an array which is first increasing and then decreasing

C/C++ Program for Count smaller elements on right side

C/C++ Program for Minimum number of jumps to reach end

C/C++ Program for Implement two stacks in an array

C/C++ Program for Find subarray with given sum

C/C++ Program for Dynamic Programming | Set 14 (Maximum Sum Increasing Subsequence)

C/C++ Program for Longest Monotonically Increasing Subsequence Size (N log N)

C/C++ Program for Find a triplet that sum to a given value

C/C++ Program for Find the smallest positive number missing from an unsorted array

C/C++ Program for Find the two numbers with odd occurrences in an unsorted array

C/C++ Program for The Celebrity Problem

C/C++ Program for Dynamic Programming | Set 15 (Longest Bitonic Subsequence)

C/C++ Program for Find a sorted subsequence of size 3 in linear time

C/C++ Program for Largest subarray with equal number of 0s and 1s

C/C++ Program for Dynamic Programming | Set 18 (Partition problem)

C/C++ Program for Maximum Product Subarray

C/C++ Program for Find a pair with the given difference

C/C++ Program for Replace every element with the next greatest

C/C++ Program for Dynamic Programming | Set 20 (Maximum Length Chain of Pairs)

C/C++ Program for Find four elements that sum to a given value | Set 1 (n^3 solution)

C/C++ Program for Find four elements that sum to a given value | Set 2 ( O(n^2Logn) Solution)

C/C++ Program for Sort a nearly sorted (or K sorted) array

C/C++ Program for Maximum circular subarray sum

C/C++ Program for Find the row with maximum number of 1s

C/C++ Program for Median of two sorted arrays of different sizes

C/C++ Program for Print unique rows in a given boolean matrix

C/C++ Program for Shuffle a given array

C/C++ Program for Count the number of possible triangles

C/C++ Program for Iterative Quick Sort

C/C++ Program for Inplace M x N size matrix transpose | Updated

C/C++ Program for Find the number of islands

C/C++ Program for Construction of Longest Monotonically Increasing Subsequence (N log N)

C/C++ Program for Find the first circular tour that visits all petrol pumps

C/C++ Program for Arrange given numbers to form the biggest number

C/C++ Program for Dynamic Programming | Set 27 (Maximum sum rectangle in a 2D matrix)

C/C++ Program for Pancake sorting

C/C++ Program for A Pancake Sorting Problem

C/C++ Program for Tug of War

C/C++ Program for Print Matrix Diagonally

C/C++ Program for Divide and Conquer | Set 3 (Maximum Subarray Sum)

C/C++ Program for Counting Sort

C/C++ Program for Merge Overlapping Intervals

C/C++ Program for Find the maximum repeating number in O(n) time and O(1) extra space

C/C++ Program for Stock Buy Sell to Maximize Profit

C/C++ Program for Rearrange positive and negative numbers in O(n) time and O(1) extra space

C/C++ Program for Sort elements by frequency | Set 2

C/C++ Program for Find a peak element

C/C++ Program for Print all possible combinations of r elements in a given array of size n

C/C++ Program for Given an array of of size n and a number k, find all elements that appear more than n/k times

C/C++ Program for Find the point where a monotonically increasing function becomes positive first time

C/C++ Program for Find the Increasing subsequence of length three with maximum product

C/C++ Program for Find the minimum element in a sorted and rotated array

C/C++ Program for Stable Marriage Problem

C/C++ Program for Merge k sorted arrays | Set 1

C/C++ Program for Radix Sort

C/C++ Program for Move all zeroes to end of array

C/C++ Program for Find number of pairs such that x^y > y^x

C/C++ Program for Count all distinct pairs with difference equal to k

C/C++ Program for Count all possible paths from top left to bottom right of a mXn matrix

C/C++ Program for Suffix Array | Set 1 (Introduction)

C/C++ Program for Rearrange an array so that arr[i] becomes arr[arr[i]] with O(1) extra space

C/C++ Program for Sort n numbers in range from 0 to n^2 – 1 in linear time

C/C++ Program for Count all possible groups of size 2 or 3 that have sum as multiple of 3

Matrix C/C++ Programs

C Program to check if two given matrices are identical
C program to find transpose of a matrix
C program for subtraction of matrices
C program for addition of two matrices
C program to multiply two matrices
C/C++ Program for Print a given matrix in spiral form
C/C++ Program for A Boolean Matrix Question
C/C++ Program for Print Matrix Diagonally
C Program to find the number of islands
C Program to find maximum size square sub-matrix with all 1s
C/C++ program for the celebrity problem
C/C++ Program for Print a given matrix in spiral form

String C/C++ Programs

C program to swap two Strings

C Program to Check if a Given String is Palindrome

C Program to Sort an array of names or strings

C/C++ Program for Return maximum occurring character in the input string

C/C++ Program for Remove all duplicates from the input string.

C/C++ Program for Print all the duplicates in the input string.

C/C++ Program for Remove characters from the first string which are present in the second string

C/C++ Program for A Program to check if strings are rotations of each other or not

C/C++ Program for Print reverse of a string using recursion

C/C++ Program for Write a C program to print all permutations of a given string

C/C++ Program for Divide a string in N equal parts

C/C++ Program for Given a string, find its first non-repeating character

C/C++ Program for Print list items containing all characters of a given word

C/C++ Program for Reverse words in a given string

C/C++ Program for Run Length Encoding

C/C++ Program for Find the smallest window in a string containing all characters of another string

C/C++ Program for Searching for Patterns | Set 1 (Naive Pattern Searching)

C/C++ Program for Searching for Patterns | Set 2 (KMP Algorithm)

C/C++ Program for Searching for Patterns | Set 3 (Rabin-Karp Algorithm)

C/C++ Program for Searching for Patterns | Set 4 (A Naive Pattern Searching Question)

C/C++ Program for Length of the longest substring without repeating characters

C/C++ Program for Print all permutations with repetition of characters

C/C++ Program for Print all interleavings of given two strings

C/C++ Program for Check whether a given string is an interleaving of two other given strings

C/C++ Program for Check whether two strings are anagram of each other

C/C++ Program for Searching for Patterns | Set 5 (Finite Automata)

C/C++ Program for Pattern Searching | Set 6 (Efficient Construction of Finite Automata)

C/C++ Program for Pattern Searching | Set 7 (Boyer Moore Algorithm – Bad Character Heuristic)

C/C++ Program for Dynamic Programming | Set 17 (Palindrome Partitioning)

C/C++ Program for Lexicographic rank of a string

C/C++ Program for Print all permutations in sorted (lexicographic) order

C/C++ Program for Longest Palindromic Substring | Set 1

C/C++ Program for An in-place algorithm for String Transformation

C/C++ Program for Longest Palindromic Substring | Set 2

C/C++ Program for Given a sequence of words, print all anagrams together | Set 1

C/C++ Program for Given a sequence of words, print all anagrams together | Set 2

C/C++ Program for Count words in a given string

C/C++ Program for String matching where one string contains wildcard characters

C/C++ Program for Write your own atoi()

C/C++ Program for Dynamic Programming | Set 29 (Longest Common Substring)

C/C++ Program for Remove “b” and “ac” from a given string

C/C++ Program for Dynamic Programming | Set 33 (Find if a string is interleaved of two other strings)

C/C++ Program for Find the first non-repeating character from a stream of characters

C/C++ Program for Recursively remove all adjacent duplicates

C/C++ Program for Rearrange a string so that all same characters become d distance away

C program to find second most frequent character

Linked List C/C++ Programs:

C/C++ Program for Introduction to Linked List

C/C++ Program for Linked List Insertion

C/C++ Program for Write a function to get Nth node in a Linked List

C/C++ Program for Given only a pointer to a node to be deleted in a singly linked list, how do you delete it?

C/C++ Program to print the middle of a given linked list

C/C++ Program for Nth node from the end of a Linked List

C/C++ Program to delete a Linked List

C/C++ Program to counts the number of times a given int occurs in a Linked List

C/C++ Program for Given only a pointer to a node to be deleted in a singly linked list, how do you delete it?

C/C++ Program to reverse a linked list

C/C++ Program to detect loop in a linked list

C/C++ Program to check if a singly linked list is palindrome

C/C++ Program The Great Tree-List Recursion Problem.

C/C++ Program to Copy a linked list with next and arbit pointer

C/C++ Program for Given a linked list which is sorted, how will you insert in sorted way

C/C++ Program for Write a function to get the intersection point of two Linked Lists.

C/C++ Program for Write a recursive function to print reverse of a Linked List

C/C++ Program for Remove duplicates from a sorted linked list

C/C++ Program for Remove duplicates from an unsorted linked list

C/C++ Program for Reverse a Doubly Linked List

C/C++ Program for Split a Circular Linked List into two halves

C/C++ Program for Practice questions for Linked List and Recursion

C/C++ Program for Move last element to front of a given Linked List

C/C++ Program for Pairwise swap elements of a given linked list

C/C++ Program for Delete a node in a Doubly Linked List

C/C++ Program for Intersection of two Sorted Linked Lists

C/C++ Program for Delete alternate nodes of a Linked List

C/C++ Program for Alternating split of a given Singly Linked List

C/C++ Program for Merge two sorted linked lists

C/C++ Program for Identical Linked Lists

C/C++ Program for Merge Sort for Linked Lists

C/C++ Program for Reverse a Linked List in groups of given size

C/C++ Program for Sorted insert for circular linked list

C/C++ Program for Reverse alternate K nodes in a Singly Linked List

C/C++ Program for Delete nodes which have a greater value on right side

C/C++ Program for Segregate even and odd nodes in a Linked List

C/C++ Program for Detect and Remove Loop in a Linked List

C/C++ Program for XOR Linked List – A Memory Efficient Doubly Linked List | Set 1

C/C++ Program for Add two numbers represented by linked lists | Set 1

C/C++ Program for How to write C functions that modify head pointer of a Linked List?

C/C++ Program for Delete a given node in Linked List under given constraints

C/C++ Program for Sorted Linked List to Balanced BST

C/C++ Program for In-place conversion of Sorted DLL to Balanced BST

C/C++ Program for Union and Intersection of two Linked Lists

C/C++ Program for XOR Linked List – A Memory Efficient Doubly Linked List | Set 2

C/C++ Program for Find a triplet from three linked lists with sum equal to a given number

C/C++ Program for Rotate a Linked List

C/C++ Program for Implement LRU Cache

C/C++ Program for Flattening a Linked List

C/C++ Program for Add two numbers represented by linked lists | Set 2

C/C++ Program for Sort a linked list of 0s, 1s and 2s

C/C++ Program for Flatten a multilevel linked list

C/C++ Program for QuickSort on Doubly Linked List

C/C++ Program for Swap Kth node from beginning with Kth node from end in a Linked List

C/C++ Program for Design a stack with operations on middle element

C/C++ Program for Delete N nodes after M nodes of a linked list

C/C++ Program for QuickSort on Singly Linked List

C/C++ Program for Merge a linked list into another linked list at alternate positions

C/C++ Program for Pairwise swap elements of a given linked list by changing links

C/C++ Program for Given a linked list, reverse alternate nodes and append at the end

C Program for Bubble Sort on Linked List

Stack C/C++ Programs:

C/C++ Program for Introduction to Stack

C/C++ Program for Infix to Postfix Conversion using Stack


C/C++ Program for Evaluation of Postfix Expression

C/C++ Program for Reverse a Sting using Stack

C/C++ Program for Implement two stacks in an array

C/C++ Program for Check for balanced parentheses in an expression

C/C++ Program for Next Greater Element

C/C++ Program for Reverse a stack using recursion

C/C++ Program for The Stock Span Problem

C/C++ Program for Design and Implement Special Stack Data Structure

C/C++ Program for Implement Stack using Queues

C/C++ Program for Design a stack with operations on middle element

Queue C/C++ Programs:

C/C++ Program for Queue Introduction and Array Implementation

C/C++ Program for Linked List Implementation of Queue

C/C++ Program for Implement Queue using Stacks

C/C++ Program for Check whether a given Binary Tree is Complete or not

C/C++ Program for Find the largest multiple of 3

Tree C/C++ Programs:

C/C++ Program for Tree Traversals

C/C++ Program for Write a C program to Calculate Size of a tree

C/C++ Program for Write C Code to Determine if Two Trees are Identical

C/C++ Program for Write a C Program to Find the Maximum Depth or Height of a Tree

C/C++ Program for Write a C program to Delete a Tree.

C/C++ Program for Write an Efficient C Function to Convert a Binary Tree into its Mirror Tree

C/C++ Program for If you are given two traversal sequences, can you construct the binary tree?

C/C++ Program for Given a binary tree, print out all of its root-to-leaf paths one per line.

C/C++ Program for Lowest Common Ancestor in a Binary Search Tree.

C/C++ Program for The Great Tree-List Recursion Problem.

C/C++ Program for Find the node with minimum value in a Binary Search Tree

C/C++ Program for Level Order Tree Traversal

C/C++ Program for Program to count leaf nodes in a binary tree

C/C++ Program for A program to check if a binary tree is BST or not

C/C++ Program for Level order traversal in spiral form

C/C++ Program for Check for Children Sum Property in a Binary Tree.

C/C++ Program for Convert an arbitrary Binary Tree to a tree that holds Children Sum Property

C/C++ Program for Diameter of a Binary Tree

C/C++ Program for How to determine if a binary tree is height-balanced?

C/C++ Program for Inorder Tree Traversal without Recursion

C/C++ Program for Inorder Tree Traversal without recursion and without stack!

C/C++ Program for Root to leaf path sum equal to a given number

C/C++ Program for Construct Tree from given Inorder and Preorder traversals

C/C++ Program for Given a binary tree, print all root-to-leaf paths

C/C++ Program for Double Tree

C/C++ Program for Maximum width of a binary tree

C/C++ Program for Total number of possible Binary Search Trees with n keys

C/C++ Program for Foldable Binary Trees

C/C++ Program for Print nodes at k distance from root

C++ Program for Inorder predecessor and successor of a given key in BST

C/C++ Program for Sorted order printing of a given array that represents a BST

C/C++ Program for Applications of tree data structure

C/C++ Program for Inorder Successor in Binary Search Tree

C/C++ Program for Find k-th smallest element in BST (Order Statistics in BST)

C/C++ Program for Get Level of a node in a Binary Tree

C/C++ Program for Print Ancestors of a given node in Binary Tree

C/C++ Program for Print BST keys in the given range

C/C++ Program for Tournament Tree (Winner Tree) and Binary Heap

C/C++ Program for Check if a given Binary Tree is SumTree

C/C++ Program for Decision Trees – Fake (Counterfeit) Coin Puzzle (12 Coin Puzzle)

C/C++ Program for Check if a binary tree is subtree of another binary tree

C/C++ Program for Trie | (Insert and Search)

C/C++ Program for Trie | (Delete)

C/C++ Program for Connect nodes at same level

C/C++ Program for Connect nodes at same level using constant extra space

C/C++ Program for Sorted Array to Balanced BST

C/C++ Program for Populate Inorder Successor for all nodes

C/C++ Program for Convert a given tree to its Sum Tree

C/C++ Program for Find the largest BST subtree in a given Binary Tree

C/C++ Program for AVL Tree | Set 1 (Insertion)

C/C++ Program for Vertical Sum in a given Binary Tree

C/C++ Program for AVL Tree | Set 2 (Deletion)

C/C++ Program for Merge Two Balanced Binary Search Trees

C/C++ Program for Find the maximum sum leaf to root path in a Binary Tree

C/C++ Program for Merge two BSTs with limited extra space

C/C++ Program for Binary Tree to Binary Search Tree Conversion

C/C++ Program for Construct Special Binary Tree from given Inorder traversal

C/C++ Program for Construct a special tree from given preorder traversal

C/C++ Program for Check if each internal node of a BST has exactly one child

C/C++ Program for Check whether a given Binary Tree is Complete or not

C/C++ Program for Boundary Traversal of binary tree

C/C++ Program for Two nodes of a BST are swapped, correct the BST

C/C++ Program for Construct Full Binary Tree from given preorder and postorder traversals

C/C++ Program for Construct BST from given preorder traversal | Set 1

C/C++ Program for Construct BST from given preorder traversal | Set 2

C/C++ Program for Floor and Ceil from a BST

C/C++ Program for Iterative Preorder Traversal

C/C++ Program for Convert a BST to a Binary Tree such that sum of all greater keys is added to every key

C/C++ Program for Morris traversal for Preorder

C/C++ Program for Linked complete binary tree & its creation

C/C++ Program for Ternary Search Tree

C/C++ Program for Segment Tree | Set 1 (Sum of given range)

C/C++ Program for Segment Tree | Set 2 (Range Minimum Query)

C/C++ Program for Dynamic Programming | Set 26 (Largest Independent Set Problem)

C/C++ Program for Iterative Postorder Traversal | Set 1 (Using Two Stacks)

C/C++ Program for Iterative Postorder Traversal | Set 2 (Using One Stack)

C/C++ Program for Find if there is a triplet in a Balanced BST that adds to zero

C/C++ Program for Find a pair with given sum in a Balanced BST

C/C++ Program for Reverse Level Order Traversal

C/C++ Program for Construct Complete Binary Tree from its Linked List Representation

C/C++ Program for Remove BST keys outside the given range

C/C++ Program for Convert a given Binary Tree to Doubly Linked List | Set 1

C/C++ Program for B-Tree | Set 1 (Introduction)

C/C++ Program for B-Tree | Set 2 (Insert)

C/C++ Program for Longest prefix matching – A Trie based solution in Java

C/C++ Program for Tree Isomorphism Problem

C/C++ Program for Find all possible interpretations of an array of digits

C/C++ Program for Iterative Method to find Height of Binary Tree

C/C++ Program for Custom Tree Problem

C/C++ Program for Check for Identical BSTs without building the trees

C/C++ Program for Convert a given Binary Tree to Doubly Linked List | Set 2

C/C++ Program for Print ancestors of a given binary tree node without recursion

C/C++ Program for Difference between sums of odd level and even level nodes of a Binary Tree

C/C++ Program for Print Postorder traversal from given Inorder and Preorder traversals

C/C++ Program for Find depth of the deepest odd level leaf node

C/C++ Program for Check if all leaves are at same level

C/C++ Program for Print Left View of a Binary Tree

C/C++ Program for B-Tree | Set 3 (Delete)

C/C++ Program for Add all greater values to every node in a given BST

C/C++ Program for Remove all nodes which don’t lie in any path with sum>= k

C/C++ Program for Extract Leaves of a Binary Tree in a Doubly Linked List

C/C++ Program for Deepest left leaf node in a binary tree

C/C++ Program for Find next right node of a given key

C/C++ Program for Splay Tree | Set 1 (Search)

C/C++ Program for Splay Tree | Set 2 (Insert)

C/C++ Program for Sum of all the numbers that are formed from root to leaf paths

C/C++ Program for Red-Black Tree | Set 1 (Introduction)

C/C++ Program for Red-Black Tree | Set 2 (Insert)

C/C++ Program for Convert a given Binary Tree to Doubly Linked List | Set 3

C/C++ Program for Print all nodes that don’t have sibling

C/C++ Program for Lowest Common Ancestor in a Binary Tree | Set 1

C/C++ Program for Find distance between two given keys of a Binary Tree

C/C++ Program for Print all nodes that are at distance k from a leaf node

C/C++ Program for Check if a given Binary Tree is height balanced like a Red-Black Tree

C/C++ Program for Interval Tree

C/C++ Program for Print a Binary Tree in Vertical Order | Set 1

C/C++ Program for Print all nodes at distance k from a given node

C/C++ Program to find the maximum path sum between two leaves of a binary tree

Graph C/C++ Programs:

C/C++ Program for Depth First Traversal for a Graph

C/C++ Program for Breadth First Traversal for a Graph

C/C++ Program for Detect Cycle in a Directed Graph

C/C++ Program for Find if there is a path between two vertices in a directed graph

C/C++ Program for Hamiltonian Cycle Detection

C/C++ Program for Dynamic Programming | Set 16 (Floyd Warshall Algorithm)

C/C++ Program for Find the number of islands

C/C++ Program for Union-Find Algorithm | Set 1 (Detect Cycle in a an Undirected Graph)

C/C++ Program for Union-Find Algorithm | Set 2 (Union By Rank and Path Compression)

C/C++ Program for Greedy Algorithms | Set 2 (Kruskal’s Minimum Spanning Tree Algorithm)

C/C++ Program for Graph and its representations

C/C++ Program for Greedy Algorithms | Set 5 (Prim’s Minimum Spanning Tree (MST))

C/C++ Program for Greedy Algorithms | Set 6 (Prim’s MST for Adjacency List Representation)

C/C++ Program for Greedy Algorithms | Set 7 (Dijkstra’s shortest path algorithm)

C/C++ Program for Greedy Algorithms | Set 8 (Dijkstra’s Algorithm for Adjacency List Representation)

C/C++ Program for Dynamic Programming | Set 23 (Bellman–Ford Algorithm)

C/C++ Program for Transitive closure of a graph

C/C++ Program for Check whether a given graph is Bipartite or not

C/C++ Program for Topological Sorting

C/C++ Program for Shortest Path in Directed Acyclic Graph

C/C++ Program for Strongly Connected Components

C/C++ Program for Articulation Points (or Cut Vertices) in a Graph

C/C++ Program for Bridges in a graph

C/C++ Program for Biconnected graph

C/C++ Program for Connectivity in a directed graph

C/C++ Program for Eulerian path and circuit

C/C++ Program for Ford-Fulkerson Algorithm for Maximum Flow Problem

C/C++ Program for Maximum Bipartite Matching

C/C++ Program for Find minimum s-t cut in a flow network

C/C++ Program for Fleury’s Algorithm for printing Eulerian Path or Circuit

C/C++ Program for Longest Path in a Directed Acyclic Graph

C/C++ Program for Find maximum number of edge disjoint paths between two vertices

C/C++ Program for Detect cycle in an undirected graph

C/C++ Program for Travelling Salesman Problem | Set 1 (Naive and Dynamic Programming)

C/C++ Program for Travelling Salesman Problem | Set 2 (Approximate using MST)

C/C++ Program for Johnson’s algorithm for All-pairs shortest paths

C/C++ Program for Graph Coloring | Set 1 (Introduction and Applications)

C/C++ Program for Graph Coloring | Set 2 (Greedy Algorithm)

C/C++ Program for Some interesting shortest path questions | Set 1

C/C+ program to Reverse alternate levels of a perfect binary tree

C/C++ program to transform a BST to greater sum tree

Bit-Magic C/C++ Program:

C/C++ Program for Next Power of 2

C/C++ Program for Write an Efficient Method to Check if a Number is Multiple of 3

C/C++ Program for Write a C program to find the parity of an unsigned integer

C/C++ Program for Efficient way to multiply with 7

C/C++ Program for Write one line C function to find whether a no is power of two

C/C++ Program for Position of rightmost set bit

C/C++ Program for Find the Number Occurring Odd Number of Times

C/C++ Program for Check for Integer Overflow

C/C++ Program for Little and Big Endian Mystery

C/C++ Program for Write an Efficient C Program to Reverse Bits of a Number

C/C++ Program for Count set bits in an integer

C/C++ Program for Count number of bits to be flipped to convert A to B

C/C++ Program for Find the two non-repeating elements in an array of repeating elements

C/C++ Program for Rotate bits of a number

C/C++ Program for Compute the minimum or maximum of two integers without branching

C/C++ Program for Compute modulus division by a power-of-2-number

C/C++ Program for Compute the integer absolute value (abs) without branching

C/C++ Program for Find whether a given number is a power of 4 or not

C/C++ Program for Turn off the rightmost set bit

C/C++ Program for Multiply a given Integer with 3.5

C/C++ Program for Add 1 to a given number

C/C++ Program for Optimization Techniques | Set 1 (Modulus)

C/C++ Program for Next higher number with same number of set bits

C/C++ Program for Program to count number of set bits in an (big) array

C/C++ Program for A Boolean Array Puzzle

C/C++ Program for Smallest of three integers without comparison operators

C/C++ Program for Add two numbers without using arithmetic operators

C/C++ Program for Swap bits in a given number

C/C++ Program for Count total set bits in all numbers from 1 to n

C/C++ Program for Detect if two integers have opposite signs

C/C++ Program for Find the element that appears once

C/C++ Program for Binary representation of a given number

C/C++ Program for Write your own strcmp that ignores cases

C/C++ Program for Add two bit strings

C/C++ Program for Swap all odd and even bits

C/C++ Program for Find position of the only set bit

C/C++ Program for Divide and Conquer | Set 4 (Karatsuba algorithm for fast multiplication)

C/C++ Program for How to swap two numbers without using a temporary variable?

C/C++ Program for Check if a number is multiple of 9 using bitwise operators

C/C++ Mathematical Programs

C/C++ Program for Write an Efficient Method to Check if a Number is Multiple of 3

C Program to print first n Fibonacci Numbers

C program to find area of a circle

C program to find area of a triangle

C program to calculate the value of nPr

C Program to find sum of series 1 + 1/2 + 1/3 + 1/4 + .. + 1/n

C/C++ Program for Efficient way to multiply with 7

C/C++ Program for Write a C program to print all permutations of a given string

C/C++ Program for Lucky Numbers

C/C++ Program for Write a program to add two numbers in base 14

C/C++ Program for Babylonian method for square root

C/C++ Program for Multiply two integers without using multiplication, division and bitwise operators, and no loops

C/C++ Program for Print all combinations of points that can compose a given number

C/C++ Program for Write you own Power without using multiplication(*) and division(/) operators

C/C++ Program for Fibonacci numbers

C/C++ Program for Average of a stream of numbers

C/C++ Program for Check whether a given point lies inside a triangle or not

C/C++ Program for Count numbers that don’t contain 3

C/C++ Program for Magic Square

C/C++ Program for Sieve of Eratosthenes

C/C++ Program for Find day of the week for a given date

C/C++ Program for DFA based division

C/C++ Program for Generate integer from 1 to 7 with equal probability

C/C++ Program for Given a number, find the next smallest palindrome

C/C++ Program for Make a fair coin from a biased coin

C/C++ Program for Check divisibility by 7

C/C++ Program for Find the largest multiple of 3

C/C++ Program for Lexicographic rank of a string

C/C++ Program for Print all permutations in sorted (lexicographic) order

C/C++ Program for Shuffle a given array

C/C++ Program for Space and time efficient Binomial Coefficient

C/C++ Program for Reservoir Sampling

C/C++ Program for Pascal’s Triangle

C/C++ Program for Select a random number from stream, with O(1) space

C/C++ Program for Find the largest multiple of 2, 3 and 5

C/C++ Program for Efficient program to calculate e^x

C/C++ Program for Measure one litre using two vessels and infinite water supply

C/C++ Program for Efficient program to print all prime factors of a given number

C/C++ Program for Print all possible combinations of r elements in a given array of size n

C/C++ Program for Random number generator in arbitrary probability distribution fashion

C/C++ Program for How to check if two given line segments intersect?

C/C++ Program for How to check if a given point lies inside or outside a polygon?

C/C++ Program for Convex Hull | Set 1 (Jarvis’s Algorithm or Wrapping)

C/C++ Program for Convex Hull | Set 2 (Graham Scan)

C/C++ Program for How to check if a given number is Fibonacci number?

C/C++ Program for Russian Peasant Multiplication

C Program to Draw a circle without floating point arithmetic

C++ Program to print all palindromes in a given range

C/C++ Dynamic Programming Programs

C/C++ Program for Largest Sum Contiguous Subarray

C/C++ Program for Ugly Numbers

C/C++ Program for Maximum size square sub-matrix with all 1s

C/C++ Program for Program for Fibonacci numbers

C/C++ Program for Overlapping Subproblems Property

C/C++ Program for Optimal Substructure Property

C/C++ Program for Longest Increasing Subsequence

C/C++ Program for Longest Common Subsequence)

C/C++ Program for Edit Distance

C/C++ Program for Min Cost Path

C/C++ Program for Length of the longest substring without repeating characters

C/C++ Program for Minimum number of jumps to reach end

C/C++ Program for Coin Change)

C/C++ Program for Matrix Chain Multiplication

C/C++ Program for Binomial Coefficient

C/C++ Program for 0-1 Knapsack Problem

C/C++ Program for Egg Dropping Puzzle

C/C++ Program for Longest Palindromic Subsequence

C/C++ Program for Cutting a Rod

C/C++ Program for Maximum Sum Increasing Subsequence

C/C++ Program for Longest Bitonic Subsequence

C/C++ Program for Floyd Warshall Algorithm

C/C++ Program for Palindrome Partitioning

C/C++ Program for Partition problem

C/C++ Program for Word Wrap Problem

C/C++ Program for Maximum Length Chain of Pairs

C/C++ Program for Box Stacking Problem

C/C++ Program for Longest Palindromic Substring

C/C++ Program for Bellman–Ford Algorithm

C/C++ Program for Optimal Binary Search Tree

C/C++ Program for Subset Sum Problem

C/C++ Program for Largest Independent Set Problem

C/C++ Program for Maximum sum rectangle in a 2D matrix

C/C++ Program for Minimum insertions to form a palindrome

C/C++ Program for Longest Common Substring

C/C++ Program for Dice Throw

C/C++ Program for Optimal Strategy for a Game

C/C++ Program for Word Break Problem

C/C++ Program for Find if a string is interleaved of two other strings

C/C++ Program for Assembly Line Scheduling

C/C++ Program for Longest Arithmetic Progression

C/C++ Program for Maximum Product Cutting

C/C++ Program for Count all possible paths from top left to bottom right of a mXn matrix

C/C++ Greedy Algorithm Programs

C/C++ Program Activity Selection Problem

C/C++ Program Kruskal’s Minimum Spanning Tree Algorithm

C/C++ Program for Huffman Coding

C/C++ Program for Efficient Huffman Coding for Sorted Input

C/C++ Program for Prim’s Minimum Spanning Tree (MST)

C/C++ Program for Prim’s MST for Adjacency List Representation

C/C++ Program for Dijkstra’s shortest path algorithm

C/C++ Program for Dijkstra’s Algorithm for Adjacency List Representation

C/C++ Program for Graph Coloring

C/C++ Program for Rearrange a string so that all same characters become d distance away

C/C++ Backtracking Programs

C/C++ Program to print all permutations of a given string

C/C++ Program The Knight’s tour problem

C/C++ Program for Rat in a Maze

C/C++ Program for N Queen Problem

C/C++ Program for Subset Sum

C/C++ Program for m Coloring Problem

C/C++ Program for Hamiltonian Cycle

C/C++ Program for Sudoku

C/C++ Program for Tug of War

C/C++ Program for (Solving Cryptarithmetic Puzzles

C/C++ Divide and Conquer Programs:

C/C++ Program for Write a C program to calculate pow(x,n)

C/C++ Program for Median of two sorted arrays

C/C++ Program for Count Inversions in an array

C/C++ Program for Check for Majority Element in a sorted array

C/C++ Program for Maximum and minimum of an array using minimum number of comparisons

C/C++ Program for Program to count number of set bits in an (big) array

C/C++ Program for Count the number of occurrences in a sorted array

C/C++ Program for Find a Fixed Point in a given array

C/C++ Program for Find the maximum element in an array which is first increasing and then decreasing

C/C++ Program for Median of two sorted arrays of different sizes

C/C++ Program for Closest Pair of Points

C/C++ Program for Maximum Subarray Sum

C/C++ Program for Largest Rectangular Area in a Histogram

C/C++ Program for Karatsuba algorithm for fast multiplication)

C/C++ Program for Find a peak element

C/C++ Program for Find the point where a monotonically increasing function becomes positive first time

C/C++ Program for Find the minimum element in a sorted and rotated array

C/C++ Program for Closest Pair of Points | O(nlogn) Implementation

C/C++ String Searching Programs:

C/C++ Program for Naive Pattern Searching

C/C++ Program for KMP Algorithm

C/C++ Program for Rabin-Karp Algorithm

C/C++ Program for A Naive Pattern Searching Question

C/C++ Program for Finite Automata

C/C++ Program for Efficient Construction of Finite Automata

C/C++ Program for Boyer Moore Algorithm – Bad Character Heuristic

C/C++ Program for String matching where one string contains wildcard characters

C/C++ Program for Suffix Array

C/C++ Geometric Algorithm Programs:

C/C++ Program for How to check if two given line segments intersect?

C/C++ Program for How to check if a given point lies inside or outside a polygon?

C/C++ Program for Convex Hull | (Jarvis’s Algorithm or Wrapping)

C/C++ Program for Convex Hull | (Graham Scan)

C/C++ Program for Given n line segments, find if any two segments intersect

C/C++ Program for Closest Pair of Points | O(nlogn) Implementation

C/C++ Program for Find if two rectangles overlap

C/C++ Misc Programs:

C Program to print environment variable

C Program for Tower of Hanoi

C Program to print Floyd’s triangle

C Program to Swap two Numbers

C program swap two numbers without using a temporary variable

C Program to check if a given year is leap year

C Program to sum the digits of a given number in single statement?

C program to print numbers from 1 to 100 without using loop?

C Program to print contents of file

C program to copy contents of one file to another file

C Program to list all files and sub-directories in a directory

C program to delete a file

C Program to merge contents of two files into a third file

C Program to count number of lines in a file

C/C++ Program for Check if a number is Palindrome

C/C++ Program for Print all possible combinations of r elements in a given array of size n

C/C++ Program for Print all possible strings of length k that can be formed from a set of n characters

C/C++ Program to Find Excel column name from a given column number

C/C++ Program to Find next greater number with same set of digits

C/C++ Program to Count Possible Decodings of a given Digit Sequence

C/C++ Program to calculate the angle between hour hand and minute hand



  • Last Updated : 26 Sep, 2023

Share your thoughts in the comments