Practice Problems on Array Rearrangement

Quick Links :


Array Rearrangement

Arrays are fundamental data structures in programming, allowing us to store and manipulate collections of related data. One common operation we may need to perform on arrays is rearranging their elements. Array rearrangement can serve various purposes, such as sorting the elements, reversing the order, or positioning specific elements in desired locations. In this article, we’ll explore problem based on arranging array elements.

Similar Reads

Practice Problems on Array Rearrangement:

Rearrange an array such that arr[i] = i Write a program to reverse an array or string Rearrange array such that arr[i] >= arr[j] if i is even and arr[i]<=arr[j] if i is odd and j < i Rearrange positive and negative numbers in O(n) time and O(1) extra space Rearrange array in alternating positive & negative items with O(1) extra space | Set 1 Move all zeroes to end of array Move all zeroes to end of array | Set-2 (Using single traversal) Minimum swaps required to bring all elements less than or equal to k together Rearrange positive and negative numbers using inbuilt sort function Rearrange array such that even positioned are greater than odd Rearrange an array in order – smallest, largest, 2nd smallest, 2nd largest, .. Double the first element and move zero to end Reorder an array according to given indexes Rearrange positive and negative numbers with constant extra space Arrange given numbers to form the biggest number Rearrange an array such that ‘arr[j]’ becomes ‘i’ if ‘arr[i]’ is ‘j’ Rearrange an array in maximum minimum form | Set 1 Rearrange an array in maximum minimum form | Set 2 (O(1) extra space) Move all negative numbers to beginning and positive to end with constant extra space Move all negative elements to end in order with extra space allowed Rearrange array such that even index elements are smaller and odd index elements are greater Positive elements at even and negative at odd positions Replace every array element by multiplication of previous and next Shuffle a given array Segregate even and odd numbers Segregate 0s and 1s in an array Longest Bitonic Subsequence Find a sorted subsequence of size 3 in linear time Largest subarray with equal number of 0s and 1s Maximum Product Sub-array Replace every element with the greatest element on right side Maximum circular subarray sum Construction of Longest Increasing Subsequence (N log N) Sort elements by frequency | Set 2 Maximize sum of consecutive differences in a circular array Sort an array according to the order defined by another array Find Index of 0 to be replaced with 1 to get longest continuous sequence of 1s in a binary array Three way partitioning of an array around a given range Generate all possible sorted arrays from alternate elements of two given sorted arrays Minimum number of swaps required for arranging pairs adjacent to each other Convert array into Zig-Zag fashion Form minimum number from given sequence Replace two consecutive equal values with one greater Rearrange a binary string as alternate x and y occurrences Distinct adjacent elements in an array Shuffle 2n integers as a1-b1-a2-b2-a3-b3-..bn without using extra space Merge k sorted arrays...