- Describe the linked list structure by a diagram.
- Compare arrays and linked lists. Write down their pros and cons.
- What is a linked list’s head? How is it different from a node? Explain.
- How do you calculate
length
of a linked list? - How do you implement
add_after
on a singly linked list? - What is the result of running this code on the input values
1 3 5 7 9
? Draw a picture representing memory.
typedef struct node_ {
int data;
struct node_ * next;
} IntNode;
IntNode * head = NULL;
IntNode * n;
int val;
while (scanf("%d", &val) == 1) {
n = (IntNode *) malloc(sizeof(IntNode));
n->data = val;
n->next = head;
head = n;
}