Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Linked List

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 35
    Comment on it

    Linked list is used to store information at the dynamic level.

     

    Each link stores the address and the information part and links to another node in the list.

     

    Linked List

     

    Types of Linked List

     

    • Simple Linked List − Iteration is forward only.

    • Doubly Linked List − Iteration is  forward and backward way.

    • Circular Linked List − Last item contains link of the first element as next and and first element has link to last element as prev.

     

    Operation in Linked List

     

    • Insertion − add element at beginning of  the list.

    • Deletion − delete element from beginning of the list.

    • Display − displaying complete list.

    • Search − search an element from the list.

    • Delete − delete an element from the list.

     

     

    //insert link at the first location
    void insertFirst(int key, int data){
       //create a link
       struct node *link = (struct node*) malloc(sizeof(struct node));
       link->key = key;
       link->data = data;
    	
       //point it to old first node
       link->next = head;
    	
       //point first to new first node
       head = link;
    }

     

    //delete first item
    struct node* deleteFirst(){
       //save reference to first link
       struct node *tempLink = head;
    	
       //mark next to first link as first 
       head = head->next;
    	
       //return the deleted link
       return tempLink;
    }

     

    .net

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: