Array based lists
Array based lists
• List
– Collection of elements of same type
• Length of a list
– Number of elements in the list
• Many operations may be performed on a list
– Create the list. The list is initialized to an empty state
– Determine whether the list is empty.
– Determine whether the list is full.
– Find the size of the list.
– Destroy, or clear, the list.
– Insert an item in the list at the specified location.
– Remove an item from the list at the specified location.
– Replace an item at the specified location with another item.
– Retrieve an item from the list from the specified location.
– Search the list for a given item.
• Store a list in the computer’s memory
– Using an array
length = 5
maxSize = 7
Array-Based Lists (cont’d.)
• Definitions of functions isEmpty and
isFull
length = 5
maxSize = 7