Professional Documents
Culture Documents
DS - Lecture 04 - 20180820
DS - Lecture 04 - 20180820
DS - Lecture 04 - 20180820
• Linked List
{
link head;
link tail;
};
Singly Linked List
Create an empty list
Linked List
Operations
• Create an empty list
• Insert node into head
• Insert node into tail
• Insert node into specific location
• Delete node
• Check IsEmpty
• Print List
Singly Linked List
Create an empty list
Example
Create three node linked list
Head Tail
10 8 50
Example
Create three node linked list
IntNode p = new IntNode(10);
10
p.next;
10
Example
Create three node linked list
p.Next = new IntNode(8);
p.next.next;
10 8
Example
Create three node linked list
p.Next = new IntNode(50);
50
10 8 50 p.next.next;
Example
Create three node linked list
Head Tail
Head
10 8 50
Tail