Position BinarySearch( List L, ElementType X )
{
int begin = 0,last = L->Last;
for(int i = 1;i <=last;i++)
{
if(L->Data[i] == X){
return i;
}
}
return NotFound;
}
bool Insert( List L, ElementType X )
{
if(L->Last == MAXSIZE - 1){
return false;
}
Position last = L->Last;
Position index = 0;
for(Position i = 0;i < last;i++)
{
if(L->Data[i]==X)return false;
if(L->Data[i]<X){
index = i;
break;
}
}
for(Position j = last+1;j > index;j--)
{
L->Data[j] = L->Data[j-1];
}
L->Data[index] = X;
L->Last++;
return true;
}
Position BinarySearch( List L, ElementType X ){ int begin = 0,last = L->Last; for(int i = 1;i <=last;i++) { if(L->Data[i] == X){ return i; } ...