+ 1
scilab language
Please write an algorithm that for any one-dimensional array with elements being integers determines the size of the longest continuous non-declination sub-panel (i.e. that each element of this sub-panel is greater than or equal to the previous one). For example, for the array {1, 8, 1, 1, 5, 7, 1, 1} this sub-array is {1, 1, 5, 7} and its length is 4. I should use sorting by merging. Can you please help me ?
2 Answers
+ 1
I want to See my array and get length
0
N=2*10
TAB=int(N*rand(1,N))
function T=sortuj(T,L,P)
if L<P then
S=floor((L+P)/2)
T=sortuj(T,L,S)
T=sortuj(T,S+1,P)
end
sortuj(T)
disp(T)
sortuj(TAB)
endfunction