EC Lecture Notes - Lecture 12: Doubly Linked List, Linked List, C Dynamic Memory Allocation
Document Summary
Doubly linked list search , count nodes , reverse, sort ,maximum, minimum , update. #include struct node { int info; struct node *prev, *next; struct node* start = null; int countnodes() { int counter = 0; //node current will point to head struct node *current = start; while(current != null) { //increment the counter by 1 for each node counter++; current = current->next; return counter; void sortlist() { struct node *current = null, *index = null; int temp; //check whether list is empty if(start == null) { return; else { //current will point to head for(current = start; current->next != null; current = current->next) { //index will point to node next to current for(index = current->next; index != null; index = index->next) { //node current will point to head struct node *current = start; int min; //checks if list is empty if(start == null) { printf("list is empty\n"); return 0; else {