Array C/C++ Programs

C Program to find sum of elements in a given array
C program to find largest element in an 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 Interpolation search vs Binary search
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
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



My Personal Notes arrow_drop_up