Array Rearrangement

Recent articles on Array rearrangement

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

Quick Links :


  • Last Updated : 26 Sep, 2023

Share your thoughts in the comments