## Positive elements at even and negative at odd positions (Relative order not maintained)

You have been given an array and you have to make a program to convert that array such that positive elements occur at even numbered… Read More »

## Move all negative numbers to beginning and positive to end with constant extra space

An array contains both positive and negative numbers in random order. Rearrange the array elements so that all negative numbers appear before all positive numbers.… Read More »

## Rearrange an array in order – smallest, largest, 2nd smallest, 2nd largest, ..

Given an array of integers, task is to print the array in the order – smallest number, Largest number, 2nd smallest number, 2nd largest number,… Read More »

## Distinct adjacent elements in an array

Given an array, find whether it is possible to obtain an array having distinct neighbouring elements by swapping two neighbouring array elements. Examples: Input :… Read More »

## Alternative Sorting

Given an array of integers, print the array in such a way that the first element is first maximum and second element is first minimum… Read More »

## Maximize sum of consecutive differences in a circular array

Given an array of n elements. Consider array as circular array i.e element after an is a1. The task is to find maximum sum of… Read More »

## Rearrange an array in maximum minimum form | Set 2 (O(1) extra space)

Given a sorted array of positive integers, rearrange the array alternately i.e first element should be the maximum value, second minimum value, third-second max, fourth-second… Read More »

## Three way partitioning of an array around a given range

Given an array and a range [lowVal, highVal], partition the array around the range such that array is divided in three parts. 1) All elements… Read More »

## Move all negative elements to end in order with extra space allowed

Given an unsorted array of both negative and positive integer. The task is place all negative element at the end of array without changing the… Read More »

## Sort an array according to absolute difference with given value

Given an array of n distinct elements and a number x, arrange array elements according to the absolute difference with x, i. e., element having… Read More »

## Rearrange positive and negative numbers with constant extra space

Given an array of positive and negative numbers, arrange them such that all negative integers appear before all the positive integers in the array without… Read More »

## Sort an array in wave form

Given an unsorted array of integers, sort the array into a wave like array. An array ‘arr[0..n-1]’ is sorted in wave form if arr[0] >=… Read More »

## Rearrange array in alternating positive & negative items with O(1) extra space | Set 1

Given an array of positive and negative numbers, arrange them in an alternate fashion such that every positive number is followed by negative and vice-versa… Read More »

## Rearrange positive and negative numbers in O(n) time and O(1) extra space

An array contains both positive and negative numbers in random order. Rearrange the array elements so that positive and negative numbers are placed alternatively. Number… Read More »