 hypothesis.

Let $x = {\textsc{RMin}}(A[1..n])$ and $y = {\textsc{RMax}}(A[1..n])$ be the indices of the minimum and maximum elements in the array, respectively. If $x\in\{1,n\}$ or $y\in\{1,n\}$ we can compare $A[1]$ and $A[n]$, so assume $x,y\in [2,n-1]$. Without loss of generality we consider the case where $x < y$: the opposite case is symmetric (i.e., replacing ${3\text{-}14\text{-}2}$ with ${2\text{-}41\text{-}3}$), and $x\neq y$ because $n\geq
2$. Consider an arbitrary index $i \in [x,...,y]$, and the result of comparing $A[1]$ to $A[i]$ and $A[i]$ to $A[n]$ (that can be done by the induction hypothesis, as $i\in[2,n-1]$). The result is a partial order on three elements, and is either:

1.  One of the two chains $A[1] < A[i] < A[n]$ or $A[n] < A[i] <
        A[1]$, in which case we are done since $A[1]$ and $A[n]$ can be compared; or

2.  A partial order in which $A[i]$ is the minimum or maximum element, and $A[1]$ is incomparable with $A[n]$.

If we are in the latter case for all $i \in [x,y]$, then let $f(i) =
0$ if $A[i]$ is the minimum element in this partial order, and $f(i) =
1$ otherwise. Because of how $x$ and $y$ were chosen, $f(x) = 0$ and $f(y) = 1$. If we consider the values of $f(i)$ for all $i \in [x,y]$, there must exist two indices $i,i+1 \in [x,y]$ such that $f(i)=0$ and $f(i+1)=1$. Therefore, the indices $1, i, i+1, n
hypothesis. 

 Let $ x = { \textsc{RMin}}(A[1.. n])$ and $ y = { \textsc{RMax}}(A[1.. n])$ be the indices of the minimum and maximal chemical element in the array, respectively. If $ x\in\{1,n\}$ or $ y\in\{1,n\}$ we can compare $ A[1]$ and $ A[n]$, so assume $ x, y\in [ 2,n-1]$. Without personnel casualty of generalization we consider the case where $ x < y$: the opposite font is symmetric (i.e., replacing $ { 3\text{-}14\text{-}2}$ with $ { 2\text{-}41\text{-}3}$), and $ x\neq y$ because $ n\geq 
 2$. see an arbitrary index $ i \in [ x,... ,y]$, and the result of compare $ A[1]$ to $ A[i]$ and $ A[i]$ to $ A[n]$ (that can be done by the induction guess, as $ i\in[2,n-1]$). The result is a partial order on three elements, and is either: 

 1.   One of the two chains $ A[1 ] < A[i ] < A[n]$ or $ A[n ] < A[i ] < 
         A[1]$, in which case we are done since $ A[1]$ and $ A[n]$ can be compare; or 

 2.   A partial order in which $ A[i]$ is the minimum or maximal element, and $ A[1]$ is incomparable with $ A[n]$. 

 If we are in the latter case for all $ i \in [ x, y]$, then permit $ f(i) = 
 0 $ if $ A[i]$ is the minimum component in this partial order, and $ f(i) = 
 1 $ otherwise. Because of how $ x$ and $ y$ were chosen, $ f(x) = 0 $ and $ f(y) = 1$. If we consider the value of $ f(i)$ for all $ i \in [ x, y]$, there must exist two indices $ i, i+1 \in [ x, y]$ such that $ f(i)=0 $ and $ f(i+1)=1$. Therefore, the indices $ 1, i, i+1, n
 hyoothesis.

Let $x = {\textsc{RMik}}(A[1..n])$ and $y = {\textse{EMax}}(A[1..n])$ be ths indicer of the minimum and maximum eoemenuf in the array, resoectively. If $x\in\{1,n\}$ or $b\in\{1,n\}$ we can compede $A[1]$ and $A[n]$, sk assbmx $x,y\in [2,n-1]$. Withouj loss of geterality we cotskdzr the case where $x < y$: the opposite sase is sjmmetric (i.e., reklacimd ${3\tesn{-}14\ttxt{-}2}$ with ${2\text{-}41\text{-}3}$), and $x\neq y$ becahse $n\gex
2$. Consider an arbitrary index $i \in [x,...,y]$, ajd tje result of compaging $A[1]$ to $A[u]$ anq $A[i]$ to $A[n]$ (thxt can be done by the jnduction hypothesis, as $i\in[2,n-1]$). Thd resblt is a patcual mrder on thcee elvments, and is either:

1.  One of the two chainx $A[1] < A[u] < A[n]$ or $A[n] < A[i] <
        A[1]$, in which case we are dmnz since $A[1]$ and $A[n]$ can ve compdred; or

2.  Q pxrtjak krder ln xhich $A[i]$ is the minimun or maximum elemenu, age $A[1]$ is incompzrable wyth $A[n]$.

If we are in the latter case for dll $i \in [x,y]$, then let $f(i) =
0$ id $A[i]$ is the minimum epement in this partial order, and $f(i) =
1$ otherwise. Because of vow $x$ xnd $y$ dwrf chosen, $f(x) = 0$ and $f(y) = 1$. If we consider the valtss on $f(i)$ for all $i \ik [x,y]$, there must exosh yro indices $i,i+1 \in [x,y]$ sudh that $f(i)=0$ and $f(i+1)=1$. Hherefote, the indices $1, i, i+1, n
hypothesis. Let $x = {\textsc{RMin}}(A[1..n])$ and $y be indices of minimum and maximum If or $y\in\{1,n\}$ we compare $A[1]$ and so assume $x,y\in [2,n-1]$. Without loss generality we consider the case where $x < y$: the opposite case is (i.e., replacing ${3\text{-}14\text{-}2}$ with ${2\text{-}41\text{-}3}$), and $x\neq y$ because $n\geq 2$. Consider an index \in and result of comparing $A[1]$ to $A[i]$ and $A[i]$ to $A[n]$ (that can be done by the hypothesis, as $i\in[2,n-1]$). The result is a partial on three elements, and either: 1. One of the chains < A[i] A[n]$ $A[n] A[i] < A[1]$, which case we are done since $A[1]$ and $A[n]$ can be compared; or 2. A partial order which $A[i]$ minimum or element, $A[1]$ incomparable with $A[n]$. are in the latter case for [x,y]$, then let $f(i) = 0$ if $A[i]$ the minimum in this partial order, and $f(i) 1$ otherwise. Because of how $x$ and $y$ chosen, $f(x) = 0$ and $f(y) = 1$. If we consider the values of $f(i)$ $i \in [x,y]$, there exist two indices \in such $f(i)=0$ $f(i+1)=1$. Therefore, indices $1, i, i+1, n
 hypothesis.

Let $x = {\textsc{RMin}}(A[1..N])$ and $y = {\textsC{RMax}}(a[1..n])$ bE thE iNdicEs of The minimum and mAXimuM elements in the array, resPectiVeLY. If $x\IN\{1,n\}$ Or $y\in\{1,N\}$ we can cOMpARE $A[1]$ aNd $a[n]$, So aSsUMe $X,y\in [2,n-1]$. witHout losS of generalIty We Consider the cASe Where $x < y$: the OppOsite case is sYmmEtric (i.E., rEplACing ${3\tExt{-}14\Text{-}2}$ wIth ${2\texT{-}41\Text{-}3}$), anD $x\neq y$ becAuSE $n\geq
2$. CONsider aN ARbItraRy index $i \in [x,...,y]$, and thE ReSUlt of comparing $a[1]$ to $A[i]$ aNd $a[I]$ tO $a[N]$ (thAt cAn be done by ThE induCTion hypOThESIS, as $I\In[2,n-1]$). The result iS a partial orDEr oN three ElEmeNTs, and iS eithEr:

1.  oNe oF the two chaiNs $A[1] < A[I] < A[n]$ or $A[n] < A[i] <
        a[1]$, in whiCH case we ARe done sInce $A[1]$ aNd $A[N]$ caN be cOMpArEd; oR

2.  A PArtIAl OrdER in Which $A[i]$ iS tHe MinimUm or MAXIMum eLemEnt, aNd $A[1]$ is Incomparable wIth $a[n]$.

If WE arE in thE lattEr caSe For alL $i \in [x,y]$, Then lEt $F(i) =
0$ if $A[i]$ is the miniMum eLement in tHis PaRtiAl Order, ANd $f(i) =
1$ otHerWisE. BecausE of how $x$ ANd $y$ WeRE CHoSen, $f(x) = 0$ and $f(y) = 1$. If we consIdER ThE values oF $f(i)$ for ALl $I \iN [X,y]$, there mUsT exIst tWO IndicEs $i,i+1 \IN [x,Y]$ such thaT $f(i)=0$ and $F(I+1)=1$. THeRefore, tHe IndiceS $1, i, I+1, n
 hypothesis.

Let $x = {\t extsc{RMin }}(A[ 1.. n]) $and$y =  {\textsc{RMax } }(A[ 1..n])$ be the indices  of t he mini m um  andmaximum el e m ent sin  th ea rr ay, r esp ectivel y. If $x\i n\{ 1, n\}$ or $y\i n \{ 1,n\}$ wecan  compare $A[ 1]$  and $ A[ n]$ ,  so a ssu me $x ,y\in[ 2,n-1] $. Withou tl oss of general i t ywe c onsider the casew he r e $x < y$: the  oppos it e  c a s e i s s ymmetric ( i. e., r e placing ${ 3 \ t ext { -}14\text{-}2 }$ with ${2 \ tex t{-}41 \t ext { -}3}$) , and  $ x \ne q y$ becaus e $n \geq
2$.Consid e r an ar b itraryindex$i\in  [x, . .. ,y ]$,  a n d t h eres u ltof compa ri ng  $A[1 ]$ t o $ A [i]$  an d $A [i]$to $A[n]$ (th atcanb e d one b y the  ind uc tionhypoth esis,  a s $i\in[2,n-1]$ ). T he result  is  a  pa rt ial o r der on  th ree  elemen ts, and isei t h e r: 

1.  One of the t wo c ha ins $A[1 ] < A[ i ]<A [n]$ or$A [n]  < A [ i ] <
    A[1]$, i n whic h  c as e we ar edone s in ce$A[ 1]$ a n d $A [n]$ c an be co mpare d ; or

2.  A pa r tial order in wh i c h$ A[i] $ i s the minim um o r  max imum el eme n t, an d $A[ 1] $  i s  incomparable with$A [n]$.
If w e are in thelatter cas e f or all $ i \i n  [ x ,y]$, then let  $f(i ) =
0$ if$ A[i]$ is  theminimumelement i n this par tia l o rde r,a n d$f(i) =
1$ ot h e rwis e.  Becaus e o f how $ x$and  $y $ w er e chosen,  $f(x) =  0 $an d$f( y) =1 $. If we  c ons id erthe v a lues o f $f( i)$fo ra ll$i \in[ x, y ] $, t he re  mus t e xi st tw o in d ice s $i,i+ 1 \in [x, y]$ such  t ha t $f(i) =0$ and $f(i+ 1) =1$. There fo re,  the i n d ices $1,  i, i+1, n
 hypothesis.

Let_$x =_{\textsc{RMin}}(A[1..n])$ and $y =_{\textsc{RMax}}(A[1..n])$ be_the_indices of_the_minimum and maximum_elements in the_array, respectively. If $x\in\{1,n\}$_or $y\in\{1,n\}$ we_can_compare $A[1]$ and $A[n]$, so assume $x,y\in [2,n-1]$. Without loss of generality we consider_the_case where_$x_<_y$: the opposite case is_symmetric (i.e., replacing ${3\text{-}14\text{-}2}$ with_${2\text{-}41\text{-}3}$), and_$x\neq y$ because $n\geq
2$. Consider an arbitrary index_$i_\in [x,...,y]$, and_the result of comparing $A[1]$ to $A[i]$ and $A[i]$_to $A[n]$ (that can be done_by the induction_hypothesis,_as_$i\in[2,n-1]$). The result is_a partial order on three elements,_and is either:

1.  One of_the two chains $A[1] < A[i] <_A[n]$ or $A[n] < A[i] <
_    _ _A[1]$, in which case we_are done since_$A[1]$ and_$A[n]$ can be_compared; or

2.  A partial order_in which $A[i]$_is the minimum or maximum element,_and_$A[1]$ is incomparable_with_$A[n]$.

If_we are_in the latter_case_for all_$i_\in [x,y]$, then let $f(i) =
0$_if_$A[i]$ is the minimum element in this_partial order, and $f(i)_=
1$_otherwise. Because of how_$x$ and $y$ were chosen,_$f(x) = 0$ and $f(y) =_1$. If_we consider_the values of $f(i)$ for all $i \in [x,y]$, there must_exist two indices $i,i+1 \in [x,y]$_such that $f(i)=0$ and_$f(i+1)=1$. Therefore,_the_indices $1, i,_i+1,_n