Using this code, you can read a sequence of numbers and find the
ordered pair (minimum value in subarray,maximum value in subarray)
for the subarrays having user given size within the sequence length.
WE will get a vector having these ordered pairs.
For better understanding, refer the output for this code for a user
defined sequence of length 6 and subarray of size 3 :-
Please enter no of element : 6
Please enter the elements : 3
2
5
4
1
9
Please enter the size of sub array : 3
OutPut : { (2,5) (2,5) (1,5) (1,9) }
Here, first subarray(3,2,5) is taken and ordered pair(2,5) is got.
Then, subarray(2,5,4) is taken and ordered pair(2,5) is got and so on.
Each new subarray is considered by releasing the first element in the previous
subarray and taking in the next element after the previous subarray.
Using this code, you can read a sequence of numbers and find the ordered pair (minimum value in subarray,maximum value in subarray) for the subarrays having user given size within the sequence length. WE will get a vector having these ordered pairs.
For better understanding, refer the output for this code for a user defined sequence of length 6 and subarray of size 3 :-
Please enter no of element : 6 Please enter the elements : 3 2 5 4 1 9 Please enter the size of sub array : 3
OutPut : { (2,5) (2,5) (1,5) (1,9) }
Here, first subarray(3,2,5) is taken and ordered pair(2,5) is got. Then, subarray(2,5,4) is taken and ordered pair(2,5) is got and so on. Each new subarray is considered by releasing the first element in the previous subarray and taking in the next element after the previous subarray.