SHARE
TWEET

Untitled

a guest Jun 19th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void insertLast(int key, int data) {
  2.  
  3.    //create a link
  4.    struct node *link = (struct node*) malloc(sizeof(struct node));
  5.    link->key = key;
  6.    link->data = data;
  7.    
  8.    if(isEmpty()) {
  9.       //make it the last link
  10.       last = link;
  11.    } else {
  12.       //make link a new last link
  13.       last->next = link;    
  14.      
  15.       //mark old last node as prev of new link
  16.       link->prev = last;
  17.    }
  18.  
  19.    //point last to new last node
  20.    last = link;
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top