type )and adds two more methods implementing sequence with an array if we implement the sequence adt with doubly linked listwe would get similar performance to that of the java util linkedlist class so suppose instead we want to implement sequence by storing each element of in cell [iof an array we can define position object to hold an index and reference to array aas instance variablesin this case we can then implement method element(psimply by returning [ia major drawback with this approachhoweveris that the cells in have no way to reference their corresponding positions thusafter performing an add first operationwe have no way of informing the existing positions in that their indices each went up by (remember that positions in sequence are always defined relative to their neighboring positionsnot their indiceshenceif we are going to implement general sequence with an arraywe need different approach consider an alternate solutionthenin whichinstead of storing the elements of in array awe store new kind of position object in each cell of aand we store elements in positions the new position object holds the index and the element associated with with this data structureillustrated in figure we can easily scan through the array to update the index variable for each position whose index changes because of an insertion or deletion figure an array-based implementation of the sequence adt