Session 4
Session 4
OBJECTIVES
Then you remember that you also need to buy stamps. Because of the
geography of your town, you need to do that after the bank. You could
copy your whole list onto a new piece of paper:
bank
stamps
groceries
drop off dry cleaning
Then your cell phone rings while you're at the bank "hey, I got the
stamps, don't pick up any more". You just cross STAMPS off the list, you
don't rewrite a whole new one without STAMPS in it.
number link
LINKED LISTS
A node with three data fields:
struct student {
char name[20];
int id;
double GPA;
struct student *next_student;
}
pointer_Head
pointer_Prec
pointer_Head
pointer_Prec
LINKED LISTS : OPERATIONS
Before addition to the beginning of a list that is not empty
pointer_New 39
pointer_Head
75 124
pointer_Prec
After addition to the beginning of the none empty list
pointer_New 39
pointer_Head
75 124
pointer_Prec
LINKED LISTS : OPERATIONS
Before addition in the middle of a list that is not empty
pNew
pointer_New 64
55 124
pointer_Prec
After addition in the middle of the none empty list
pNew
pointer_New 64
124
pointer_Prec 55
LINKED LISTS : OPERATIONS
Before addition at the end of a list that is not empty
pNew
pointer_New 64
55 124
pointer_Prec
pNew
pointer_New 64
55 124
pointer_Prec
LINKED LISTS :OPERATIONS
10 20 40 55 70
Rear
MOTIVATION