Given a sorted array A[] consisting ofNintegers. The task is to rearrange the array alternatively i.e. the first element should be maxed value, second should be min value, third should be the second max, fourth should be the second min, and so on. Examples: Input:A[] = {1, 2, 3...
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 of positive and negative numbers need not be equal. If there are more positive numbers they appear at the end of the array. I...
operational elements at the cross-points, in which case, the control includes a magnet per cross-point to activate the make contacts. Such a cross-point module has 16 possible states in which one or more of the make contacts are actuated simultaneously or none of the make contacts are ...
Consider an integer array, of size n, containing positive and negative elements. The task at hand is to arrange the array in such a way that the negative and positive elements are placed alternatively, that is, negative elements at an even position and positive ele...