##
Segregate Even and Odd numbers
June 7, 2010

Given an array A[], write a function that segregates even and odd numbers. The functions should put all even numbers first, and then odd numbers.

June 7, 2010

Given an array A[], write a function that segregates even and odd numbers. The functions should put all even numbers first, and then odd numbers.

May 18, 2010

Given an array arr[] of n integers, construct a Product Array prod[] (of same size) such that prod[i] is equal to the product of all… Read More »

April 27, 2010

Given two sorted arrays, find their union and intersection. For example, if the input arrays are:

April 10, 2010

Given an array arr[] of integers, find out the difference between any two elements such that larger element appears after the smaller number in arr[].

March 1, 2010

Question: Write an efficient program for printing k largest elements in an array. Elements in array can be in any order.

February 28, 2010

You are given an array of 0s and 1s in random order. Segregate 0s on left side and 1s on right side of the array.… Read More »

February 11, 2010

Question: Write a C function to find if a given integer x appears more than n/2 times in a sorted array of n integers.

January 11, 2010

Write an efficient C program to find smallest and second smallest element in an array. Example: Input: arr[] = {12, 13, 1, 10, 34, 1}… Read More »

January 10, 2010

Question: An Array of integers is given, both +ve and -ve. You need to find the two elements such that their sum is closest to… Read More »

January 3, 2010

Print the elements of an array in the decreasing frequency if 2 numbers have same frequency then print the one which came first. Examples: Input:… Read More »

December 7, 2009

Write a program to print all the LEADERS in the array. An element is leader if it is greater than all the elements to its… Read More »

November 26, 2009

Given an array of positive numbers, find the maximum sum of a subsequence with the constraint that no 2 numbers in the sequence should be… Read More »

November 14, 2009

Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements.

November 10, 2009

Write a function rotate(arr[], d, n) that rotates arr[] of size n by d elements.

Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements.