Revision as of 04:32, 3 April 2012 by Jribeir (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

John Ribeiro - Lu 8:30 - 9:20 - Lesson 22

Node * List_serach ( NOde * led, int v ) {

 while ( ( led != NULL ) && ( ( led->value ) != v ) )
 {
   led = led -> next;
 }
 return led;

}

/* Remember to check if the pointer is equal to NULL. This makes sure that the list exists in the first place. */

Node * List_InsertFront ( Node * head, int v ) {

 Node * n = Node_construct(v);
 n->next = head;
 return n;

}

Node * List_insertEnd ( Node * head, int v ) {

 Node * n = Node_construct(v);
 if ( head == NULL )
 {
   return n;
 }

/* If the list is empty create only one node */

 Node * p = head;
 while ( ( p->next) != NULL )
 {
   p = p -> next;
 }
 p->next = n;
 return head;

}

Alumni Liaison

Questions/answers with a recent ECE grad

Ryne Rayburn