Download presentation
Presentation is loading. Please wait.
Published byTracy Harvey Modified over 8 years ago
2
LIST Unsorted 1.Set PTR := START 2.Repeat Step 3 while PTR=NULL 3.If ITEM = INFO[PTR], then : Set LOC := PTR and Exit else Set PTR:=LINK[PTR] [PTR points to next node] [End of If structure] [End of Step 2 loop] 4.[Search unsuccessful] Set LOC:=NULL 5. Exit
3
LIST Sorted 1.Set PTR := START 2.Repeat Step 3 while PTR=NULL 3.If ITEM < INFO[PTR], then : Set PTR:=LINK[PTR] [move to next node] elseif ITEM = INFO[PTR], then: Set LOC := PTR and Exit [search successful] else: Set LOC:=NULL and exit [ITEM exceeds INFO[PTR]] [End of If structure] [End of Step 2 loop] 4.[Search unsuccessful] Set LOC:=NULL 5. Exit
4
Header Linked List A header linked list is the LL which will always contain a special node called “header node” at the beginning of the list. START pointer will now point to the HEADER NODE and HEADER NODE will now point to the first “actual node” of linked list.
5
Header Linked List a) Grounded header LL b) Circular header LL a) Grounded header LL b) Circular header LL START N Header Node
6
Polynomial
7
Two way lists In one way link list we can traverse in one direction, i.e. in forward direction from START We cannot traverse in backward direction or we can’t access the preceding nodes without traversing the part of LL
8
Two way lists In two way LL, we can traverse in two direction: 1) Forward direction from beginning of LL to its end 2) Backward direction from end of LL to its beginning Also we now access to both next and previous node of the LL.
9
Two way lists Each node now contains three parts: 1)INFO : contain data 2)FORW: contain address of next node 3)BACK: contain address of previous node
10
Two way circular header LL
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.