The List ADT There is a set of operations that we would like to perform on the list ADT: ■PrintList ■MakeEmpty Find:return the position of the first occurrence of a key Insert and Delete:insert and delete some key from some position in the list Findkth:return the element in some position Next and Previous:take a position as argument and return the position of the successor and predecessor
The List ADT There is a set of operations that we would like to perform on the list ADT: ◼ PrintList ◼ MakeEmpty ◼ Find: return the position of the first occurrence of a key ◼ Insert and Delete: insert and delete some key from some position in the list ◼ FindKth: return the element in some position ◼ Next and Previous: take a position as argument and return the position of the successor and predecessor
The List ADT Example:The list is 34,12,52,16,13 ■Find52) ■Insert(X,3) Deletd(52) The interpretation of what is appropriate for a function is entirely up to the programmer
The List ADT Example: The list is 34, 12, 52, 16, 13 ◼ Find(52) ◼ Insert(X, 3) ◼ Delete(52) The interpretation of what is appropriate for a function is entirely up to the programmer
Simple Array Implementation of Lists All these functions about lists can be implemented by using an array. PrintList √MakeEmpty √Find √Insert Delete Next √Previous
◼ All these functions about lists can be implemented by using an array. Simple Array Implementation of Lists ✓ PrintList ✓ MakeEmpty ✓ Find ✓ Insert ✓ Delete ✓ Next ✓ Previous