#HW 16 Nuray Kutlu #OK TO POST #C16.txt, March 18, 2024 Help:=proc(): print(`SR(INI,L,n), IsPer1(L,t), FindPer(L) `):end: qSR:=proc(q,INI, L, n) local r, i,M,ng, IsSort: r:=nops(L): IsSort:=[]: if nops(INI)<>L[-1][2] then RETURN(FAIL): fi: for i from 1 to nops(INI) do: if INI[i]>(q-1) then RETURN(FAIL): fi: od: for i from 1 to nops(L) do: if L[i][1]>(q-1) then RETURN(FAIL): fi: IsSort:= [op(IsSort), L[i][2]] od: if not (type(L,list) and {seq(type(L[i][2],posint),i=1..nops(L))}={true} and sort(IsSort)=IsSort) then RETURN(FAIL): fi: if not type(n,posint) then RETURN(FAIL): fi: M:=INI: while(nops(M))