A list is a contiguous sequence of n elements beginning at position 1 and ending at position n. 1. Using templates, design and implement the class List both as a dynamic array and as a singly-linked list. In addition to the four basic methods, the list should also support the following methods: bool Insert ( const Etype & E, int p ); To insert element E at position p where p is correctly defined from 1 to n+1. If the element is properly inserted then true is returned; otherwise, false is returned. Once inserted, all elements after E move down one position. bool Remove ( int p ); To remove the element at position p where p is correctly defined from 1 to n. If the element is properly removed then true is returned; otherwise, false is returned. Once deleted, all elements after the removed element are moved up one position. bool Retrieve ( Etype & E, int p ) const; To retrieve the element E at position p where p is correctly defined from 1 to n. If the element is properly retrieved then true is returned (in addition to E); otherwise,
This is the end of the preview. Sign up
access the rest of the document.
This note was uploaded on 02/14/2010 for the course COMPUTER S COIS-3030 taught by Professor Hircock during the Spring '10 term at Trent University.