link list cse ( data structure )
TRANSCRIPT
Welcome to Blackbaud
Our Team Members :
No Name ID
01
02
03
04
05
Sanjida Ferdus
Tapasy Rabeya
Shammi AkterSazzad Hossain Nirjhor
Shahadat Hossain
133-15-2927133-15-2986
133-15-3029
133-15-3031
133-15-2826
Welcome to Blackbaud
Spring 2003 CMSC 203 - Discrete Structures 4
–Classification of Link list : ● 1. Singly link list .● 2.Doubly Link list .● 3.circular link list .
● Link list :
Welcome to Blackbaud
Spring 2003 CMSC 203 - Discrete Structures 6
A linked list is a data structure consisting of a group of nodes which together represents a sequence. And Singly linked list is the most basic linked data structure. Each node is composed of a data and a reference to the next node.
Singly Link List.
Operations of a singly linked list :
Insert – Inserts a new element at the end of the list.Delete – Deletes any node from the list.Find – Finds any node in the list.Print – Prints the list.
Spring 2003CMSC 203 - Discrete Structures7
1.For storing different types of data.2.For making many types of apps :
Phone Book,etc3.It can be use to make different types of
small games , like snake game, tik-tak-toe, etc.
Uses
Making Link list.
Next
*Apu 01685262326 Next
*Asif 01685262326 Next
*Mohsin 01685262326 NULL
Start
Nirjhor 01685262326 NULL
start = malloc(sizeof(struct node))head = start
tail
tail = malloc(sizeof(struct node))head->next = tail
Head = head->next
Head
Searching.
Delete .
Apu 01682719094 Next
*Asif 01751048671 Next
*Mohsin 01686335730 NULL
Head
Next
*
Start
Nirjhor 01685262326
head = start
Head = head->nexttail = head
tail
Tail->next = head->next
Summer 2014
Insertion Or Add.
Next
*Apu 01682719094 Next
*Asif 01751048671 Next
*Mohsin 01686335730 NULL
Start
Head
Nirjhor 01685262326 NULL
temp
Mahmudul 01620602660 Next
*
Head->next = malloc(sizeof(struct node))Head->next= temp
Print Or Show
Nirjhor 01685262326 Next
*
Start
Apu 01682719094 Next
*Asif 01751048671 Next
*Mohsin 01686335730 NULL
head = head->next
Printf(“%s\t- %d”,head->name,head->num)
start = head
Head
Spring 2014
Advantages of linked list:-1.It is not necessary to know in advance the number of elements to be
stored in the list and therefore, need not allocate. d as and when necessary.
2.In a linked list, insertions and deletions can be handled efficiently without fixing the size of the memory in advance.
3.An important advantage of linked lists over arrays is that the linked list uses exactly as much memory as it needs, and can be made to expand to fill all available memory locations if needed.Disadvantages:-
The traversal is sequential. Increased overhead for storing pointers for linking the data items.