Program to Print all Pair of Numbers Whose Difference is K

  • Write a program to find a pair of number whose difference is equal to K
  • Algorithm to find a pair of array element whose difference is equal to given number.

Program to Find Next Greater Element for Every Array Element

  • Write a program to find next larger element of array
  • Algorithm to find next greater element using stack data structure and in O(n) time complexity.

Program to Find the Smallest Unsorted Subarray such that Sorting it Makes Whole Array Sorted

  • Write a program in C to find smallest unsorted array such that sorting this array makes whole array sorted.

Program to find Maximum Repeating Element of Array in O(n) Time

  • Write a program to find an element occurring maximum number of times in an array.
  • How to find maximum repeating element of an array in O(n) time and without using any extra memory space.

C Program to Sort an Array Containing 0, 1 and 2.

  • Write a program to sort an array containing only 0, 1 and 2.
  • Dutch flag algorithm to re arrange 0, 1 and 2 such that first all 0's then all 1's and at last all 2's.

C Program to Find Floor of a Number in Sorted Array

  • Write a program to find floor of a number in a sorted array.
  • Algorithm to find the largest number smaller than or equal to X in a sorted integer array.

C Program to Find Ceiling of a Number in Sorted Array

  • Write a program to find ceiling of a number in a sorted array.
  • Algorithm to find the smallest number greater than or equal to X in a sorted integer array.

Program to Find Union and Intersection of Two Sorted Arrays

  • Write a program to find union and intersection of two sorted integer array.
  • Algorithm to find union and intersection of two sorted array.

Program to Find Maximum Difference Between a Pair of Elements

  • Write a program to find maximum difference between elements such that larger element is after smaller element.