Sunidhi Bansal has Published 1101 Articles

Rearrange positive and negative numbers with constant extra space in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 06:54:58

241 Views

We are given an integer type array containing both positive and negative numbers, let's say, arr[] of any given size. The task is to rearrange an array in such a manner that all the elements of an array are sorted using the inbuilt sort function of C++ STL as well ... Read More

Rearrange positive and negative numbers using inbuilt sort function in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 06:51:10

932 Views

We are given an integer type array containing both positive and negative numbers, let's say, arr[] of any given size. The task is to rearrange an array in such a manner that all the elements of an array are sorted using the inbuilt sort function of C++ STL as well ... Read More

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

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 06:48:28

269 Views

We are given an integer type array containing both positive and negative numbers, let's say, arr[] of any given size. The task is to rearrange an array in such a manner that all positive and negative numbers should be at alternate positions and if there are extra positive or negative ... Read More

Rearrange array such that even positioned are greater than odd in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 06:43:15

166 Views

We are given an integer type array containing both positive and negative numbers, let's say, arr[] of any given size. The task is to rearrange an array in such a manner that all the elements at an even position or index should be greater than the elements at an odd ... Read More

Rearrange array such that even index elements are smaller and odd index elements are greater in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 06:40:49

340 Views

We are given an integer type array containing both positive and negative numbers, let's say, arr[] of any given size. The task is to rearrange an array in such a manner that all the elements at an even position or index should be less than the elements at an odd ... Read More

Rearrange array in alternating positive & negative items with O(1) extra space in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 06:38:07

507 Views

We are given an integer type array containing both positive and negative numbers, let's say, arr[] of any given size. The task is to rearrange an array in such a manner that there will be a positive number that will be surrounded by negative numbers. If there are more positive ... Read More

Rearrange an array to minimize sum of product of consecutive pair elements in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 06:34:37

201 Views

We are given a positive integer type array, let's say, arr[] of any given size. The task is to rearrange an array in such a manner that when we multiply an element with its alternative element and then add all the resultant elements then it should return the minimum sum.Let ... Read More

Rearrange an array such that every odd indexed element is greater than its previous in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 06:31:03

103 Views

We are given a positive integer type array, let's say, arr[] of any given size. The task is to rearrange an array in such a manner that all the elements present at an odd index should value greater than the element presents at an even index and print the result.Let ... Read More

Rearrange an array such that arr[i] = i in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 06:27:57

267 Views

We are given a positive integer type array, let's say, arr[] of any given size such that elements in an array should value greater than 0 but less than the size of an array. The task is to rearrange an array in such a manner that if arr[i] is ‘i’, ... Read More

Rearrange an array such that ‘arr[j]’ becomes ‘i’ if ‘arr[i]’ is ‘j’ in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 06:20:09

203 Views

We are given a positive integer type array, let's say, arr[] of any given size such that elements in an array should value greater than 0 but less than the size of an array. The task is to rearrange an array in such a manner that if arr[j] is ‘j’ ... Read More

Previous 1 ... 5 6 7 8 9 ... 111 Next
Advertisements