suppose we have an array-based list a0n - 1 and


Suppose we have an array-based list A[0..N - 1] and we want to delete all duplicates. LastPosition is initially N - 1, but gets smaller as elements are deleted. Consider the pseudocode program fragment [below]. The procedure Delete deletes the elements in position j and collapses the list.
/* 1*/ for( i = 0; i < LastPosition; i++ )
{
/* 2*/ j = i + 1;
/* 3*/ while( j < LastPosition )
/* 4*/ if( A[ i ] == A[ j ] )
/* 5*/ Delete( j );
else
/* 6*/ j++;
}
Explain how this procedure works.
Rewrite this procedure using general list operations.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: suppose we have an array-based list a0n - 1 and
Reference No:- TGS0304426

Expected delivery within 24 Hours