Function's explanation of Linked List

linked list
Introduction:

Linked list has many function as many as a user can make or developer can understand that it can create how many functions in linked list.Because there is not only single link list.There are two type of link lists the one is single and the other is double but firstly we have to understand the define of the link list.

Link List:

As by the words meaning link mean attachment of somethings which are two or more than two.When we attach these things with each other then there would be created a link in between them.Which make them to contact each other.The  second word list mean  a lot of number in a sequence or in joining one another.There list can be of one,two or more things.In together these words give the  meaning that  a list in which every element is connected with each other and make a link in between every next and previous element.Now we Go through the functions of the link list.

linked list
Functions Names:

As in the last paragraph this was discussed that the functions are as how many as developer can think to make but there are some main functions which we have to discuss here.
Functions of single link list:

  1. Initialization
  2. Create
  3. Insert at first
  4. Insert at
  5. Insert last
  6. Remove first
  7. Remove last
  8. Remove At
  9. Triverse
  10. Reverse
  11. Circular
  12. Sorting
Functions of DOUBLE LINK LIST:

  1. Initialization
  2. Creation
  3. Insert
  4. Remove

linked list

Explanation:


  1. Initialization:
In this function first the developer initialize the node in which it take a single pointer and a data.First it would have to check the first pointer that is it Null or not if it is null then must create the first node and also make this node the last node because there is no next node in next of it.
But if there already exist a node then create a new node connect it with the previous node and then make this node as the last node that when we make the  next then by last pointer we can access it and then attach  with the new one and then make that new one the last node for the next use.

  • Insert first function:
In this function first user have to check that is the node is already created or not if the node is is created then it would have make a new node and name it as first pointer.But if the node is created then it would have to take a temp pointer then add the value of first in it then insert the new node in the first and attach it with the temp pointer.
linked list

  • Insert At Last:
First the developer have to check that is the first pointer is null or not if it is null then it mean that there is no node created then make the first node and if first is not null then take a temp pointer store the value of last in it and then make the last pointer a new node and connect it with the temp pointer to stay it in the list mean making a attachment.

  • Insert At inn between the Node:
Insert between the function mean that  user first have to check that is the node is created or not if not created then create or if created then take a temporary pointer give it the value of the first and then treverse it when it reach at the deleted value then stay there give this value to the new third one temp pointer and then connect the stay pointer with the second next pointer and then delete the temp pointer.

Post a Comment

0 Comments