A list is a sequence of items with similar data types, where the order of the item's position matters. There are several common operations that are available in a List ADT, and they are:
- Get(i), which will return the value of selected index, i. If the i index is out of bounds, it will simply return -1.
- Insert(i, v), which will insert the v value at the position of index i.
- Search(v), which will return the index of the first occurrence of v (if the v value doesn't exist, the return value is -1).
- Remove(i), which will remove the item in the i index.Â
For simplicity, we are going to build a List ADT that accepts int data only, from zero (0) and higher.Â
Now, by using the array data type we discussed earlier, let's build a new...