Professional Documents
Culture Documents
N i dung
Danh sch lin k t vng Danh sch lin k t kp Danh sch lin k t i vng (v a n i kp v a n i vng)
A1
A2
A3
An
Tr ng Next c a nt cu i ko cn tr NULL, m tr n nt u
pList
A1
A2
A3
An
Node
C u trc d li u - Khoa CNTT
Tail Node
6
u pList = NULL
pList newnode new
pList
newnode
pList
newnode
u pList NULL
newnode new pList
newnode
10
11
newnode new
pList
newnode
pList
newnode
12
newnode pList
pList
newnode
13
14
pList
pList
15
p pList
p pList
16
17
pList
pList
18
p pList
pList
19
}
C u trc d li u - Khoa CNTT
20
void ShowList(NodePtr pList) { NodePtr p; if (pList == NULL ) return; p = pList->next; do { ShowNode(p); p = p->next; } while (p!=pList->next); }
21
22
23
24
Tran Tran
25
Tran Tran
26
Tran Tran
true
27
Tran Ngoc
28
Tran Ngoc
29
31
32
33
u tin
34
35
pList2
36
pList2
37
pList2
38
pList2
pList1
39
}
C u trc d li u - Khoa CNTT
40
41
n nt tr
c v sau.
A1
A2
An
42
tr tr
n nt tr n nt sau
pHead qu n l ds kp Kh i t o dslk
43
44
newnode new p
45
46
47
48
49
50
Bi t p
Xy d ng c u trc danh sch lin k t i vng
- M i nt trn danh sch c hai tr
Prev: tr Next: tr n nt tr c n nt sau
ng lin k t
- Nt cu i cng trong danh sch c tr ng next l nt u tin - Nt u tin c tr ng prev l nt cu i cng. - Cc thao tc trn danh sch:
Init, IsEmpty, NewNode, FreeNode InsertFrist, InsertLast, InsertPrev, InsertNext, InsertPos DeleteFirst, DeleteLast, DeleteNext, DeletePrev, DeletePos ShowList, ShowInvert Search, Sort. ClearList
C u trc d li u - Khoa CNTT
51
52