List
Objectives
• Explain the design, use, and operation of a linear list
• Implement a linear list using a linked list structure
• Understand the operation of the linear list ADT
• Write application programs using the linear list ADT
• Design and implement different link-list structures
Data Structures: A Pseudocode Approach
with C 1
Different Representations
t y p e s
t y p e s
t
p y
e s
Data: types
Basic Operations
• A general linear list is a list in which update operations can
be done anywhere in the list.
• Insertions and deletions are more efficient than arrays.
• Makes use of dynamically allocated storage allocation at
runtime.
• Basic list operations:
• Insertion
• Deletion
• Retrieval
• Traversal
Data Structures: A Pseudocode Approach
with C 3
Insertion
•Ordered lists are maintained in sequence according to the data or a key that
identifies the data.
•Example: ssn# t y p e s
• In Random list or chronological lists, there is no sequential relationship between
two elements.
t y p e s
•Generally found in data-gathering applications.
•There is no restriction on inserting data.
Data Structures: A Pseudocode Approach
with C 4
Deletion
• Deletion requires the list be searched to locate data being deleted.
•The predecessor of the element to be deleted has its link member assigned the
address of the successor to the deleted element.
Data Structures: A Pseudocode Approach
with C 5
Retrieval
•Requires data/element to be searched and located in a list and presented to
the calling module without the change in contents of the list.
Traversal
•List traversal processes each element in a list in sequence. Looping
algorithm used and each execution of the loop processes one element in the
list.
Data Structures: A Pseudocode Approach
with C 6
Data Structures: A Pseudocode Approach
with C 7