# include & lt; Iostream>
# include & lt; Stdlib. H>
# include & lt; Cstring>
# include & lt; Math. H>
using namespace std;
# define N 100
Typedef struct
{
The int data [N].
Int length;//the length of the linear table
} the List;
Int InitList (List& L)
{
Memset (L.d ata, 0, sizeof (L));//initialization data 0
L.l ength=0;//initialize length of 0
return 0;
}
//create order table function
Bool CreateList (List& L, int n)
{
If (n<0 | | n> N)
return false;//n illegal
Cout<& lt;" Please input keywords in turn: "& lt;for (int i=0; I & lt; n; I++)
{
Cin> L.d ata [I];
L.l ength++;
}
return true;
}
Void Bitree (List& L, int n)
{
For (int I=L.d ata [0]; I>=1; I -)
{
Int k=(int) pow (2, I);
For (int j=k; j<=(int) pow (2, I + 1) - 1 & amp; & j<=k + n - 1; J +=2)
{
L.d ata (j + 1)/2=L.d ata [j];
If (L.d ata [j] & gt; L.d ata [m + 1] & amp; & jL.d ata (j + 1)/2=L.d ata [j + 1);
}
}
L.d ata [0]=(int) pow (2, L.d ata [0]) + n - 1;
}
Void Sort (List& L, int n)
{
for(int i=1; i<=n; I++)
{
CoutInt j=1;
While (L.d ata [j] 2 *==L.d ata [1] | | L.d ata [2 * j + 1)==L.d ata [1])
{
J *=2;
If (L.d ata [j].=L.d ata [1])
j++;
}
L.d ata [j]=65535;
//adjustment
For (int k=j; K> 0; K
/=2){
If (k % 2)
J=L.d ata [k - 1);
The else
J=L.d ata [k + 1);
If (jL.d ata [k/2]=j;
The else
L.d ata [k/2]=L.d ata [k].
}
}
}
Void the display (List& L)
{
Cout<& lt;" Results: after the sorting "& lt;for (int i=0; I & lt; L.l ength; I++)
{
Cout}
Cout}
Int main ()
{
int n;
The List of L;
InitList (L);
Cout<& lt;" Please enter the number of elements: "& lt;Cin> n;
CreateList (L, n);
Bitree (m, n);
Sort (m, n);
The display (L);
return 0;
}
Tree based on sequential table structure selection sort, but lose out the answer, don't know where is wrong? For help