Upcoming SlideShare
Loading in...5
×

# Link list assi

281

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
Your message goes here
• Be the first to comment

• Be the first to like this

No Downloads
Views
Total Views
281
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Link list assi

1. 1. Title: Programs based on linked list.Introduction: The linked allocation method of storage is more suitable for much computer application. It canresult in both the efficient use of computer storage and computer time. It has followingcharacteristics: 1. Unpredictable storage requirement 2. Extensive manipulation of data stored Linked List: A linked list or one way list or chain list is a linear collection of data elements called node where the linear order is given by means of pointer. Each node is divided into two parts: 1. Information of the elements. 2. Address of the next node in the list called as linked field or next pointer field. The pointer of the last node contains a special value called null pointer which is an invalid address. In actual practice, 0 or negative number is used for null pointer. Important concepts related to Linked List: Node: Each item in the list is called a node and contains two fields such as: 1. Information field 2. Next address field 1. Information field: The Information field holds the actual elements on the list. 2. Next address field: The Next address field contains the address of the next node in the list. Pointer and Null pointer: The address which is used to access a particular node is known as a pointer. The entire linked list is accessed from an external pointer list that points to the first node in the list. The next address of the last node in the list contains a special value, known as null, which is not valid address. This null pointer is used to signal the end of the list. Empty list: The list with no nodes on it is called empty list or null list. The value of the external pointer list to such a list is the null pointer. A list can be initialize to the empty list by the operation list=null.
2. 2. Operations on linked list: 1. Searching 2. Insertion 3. Deletion 1. Searching for node from linked list Algorithm: Search_node(Start, Data) [Searches for data, start ptr to first node] Step 1: Start Step 2: Accept linked list and data Step 3: Set temp=Start Step 4: While link [temp] not equal to Null [check till end] If info [temp] =Data, then Write: “Found Successfully” Exit [if found, stop] [End of if] Set Temp=Link [tamp] [pointer is incremented to next] [End of while] Step 5: Write: “Not Found” Step 6: Exit [stop]Types of linked list:1. Linear2. Doubly3. Circular1. Linear linked list Contained within itself the address of the next items such an explicit ordering gives rise to a datastructure, which is known as a linear linked list.
3. 3. info Next Node2. Doubly linked listIn a doubly linked list, each node contains, besides the next-node link, a second link fieldpointing to the previous node in the sequence. The two links may be called forward(s) andbackwards, or next and previous. Head address to next node last Address to previous node3. CircularCircular listIn a circularly linked list, all nodes are linked in a continuous circle, without using null. For listswith a front and a back (such as a queue), one stores a reference to the last node in the list. Thenext node after the last node is the first node. Elements can be added to the back of the list andremoved from the front in constant time.Circularly linked lists can be either singly or doubly linked.Both types of circularly linked lists benefit from the ability to traverse the full list beginning atany given node. This often allows us to avoid storing firstNode and lastNode, although if the listmay be empty we need a special representation for the empty list, such as a lastNode variablewhich points to some node in the list or is null if its empty; we use such a lastNode here. Thisrepresentation significantly simplifies adding and removing nodes with a non-empty list, butempty lists are then a special case. First node last node
4. 4. Advantages of linked list :1. Linked list is an example of dynamic data structure2. Linked list can be grow and shrink during execution of the program3. It allows to use memory efficiently the memory is not allocated in advance so according toneed,memory can be allocated4. Representation of the linear data structure can be easily implement using it.5. Memory is freed whenever there is no need of it.6. Insertion and deletion are efficient and easy.