This document introduces linked lists, their basic components and types. It discusses the important elements of a linked list including links, next pointers and first pointers. It describes the basic operations of linked lists like insertion, deletion and display. It also explains different types of linked lists including singly linked lists, doubly linked lists and circular linked lists as well as their key characteristics and differences.
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
108 views
Introduction To Linked List
This document introduces linked lists, their basic components and types. It discusses the important elements of a linked list including links, next pointers and first pointers. It describes the basic operations of linked lists like insertion, deletion and display. It also explains different types of linked lists including singly linked lists, doubly linked lists and circular linked lists as well as their key characteristics and differences.
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13
Introduction to Linked List
Luansing, Naldrein Rean R.
BSIT-S2 Linked List It is a sequence of links which contains items. Each link contains a connection to another link. It is the second most-used data structure after array. Following are the important terms to understand the concept of Linked List. Link − Each link of a linked list can store a data called an element. Next − Each link of a linked list contains a link to the next link called Next. LinkedList − A Linked List contains the connection link to the first link called First. Important points to be considered in the LinkedList. Linked List contains a link element called first. Each link carries a data field(s) and a link field called next. Each link is linked with its next link using its next link. Last link carries a link as null to mark the end of the list. Types of Linked List
Simple Linked List − Item navigation is forward only.
Doubly Linked List − Items can be navigated forward and backward. Circular Linked List − Last item contains link of the first element as next and the first element has a link to the last element as previous. Basic Operations of a LinkedList Insertion − Adds an element at the beginning of the list. Deletion − Deletes an element at the beginning of the list. Display − Displays the complete list. Search − Searches an element using the given key. Delete − Deletes an element using the given key. Doubly Linked List It is a variation of Linked list in which navigation is possible in both ways, either forward and backward easily as compared to Single Linked List. It contains an extra pointer, typically called previous pointer, together with next pointer and data which are there in singly linked list. Important points to be considered in Doubly Linked List Doubly Linked List contains a link element called first and last. Each link carries a data field(s) and two link fields called next and prev. Each link is linked with its next link using its next link. Each link is linked with its previous link using its previous link. The last link carries a link as null to mark the end of the list. Circular Linked List Circular Linked List is a variation of Linked list in which the first element points to the last element and the last element points to the first element. Both Singly Linked List and Doubly Linked List can be made into a circular linked list. It is a linked list where all nodes are connected to form a circle. There is no NULL at the end. A circular linked list can be a singly circular linked list or doubly circular linked list. Singly Linked List as Circular: In singly linked list, the next pointer of the last node points to the first node.
Doubly Linked List as Circular:
In doubly linked list, the next pointer of the last node points to the first node and the previous pointer of the first node points to the last node making the circular in both directions. Important points to be considered. The last link's next points to the first link of the list in both cases of singly as well as doubly linked list. The first link's previous points to the last of the list in case of doubly linked list. Basic Operations
insert − Inserts an element at the start of the list.
delete − Deletes an element from the start of the list. display − Displays the list References