Here is the listing of C programming examples on Linked Lists.
1. C Examples on Creating and Displaying the elements of a Linked List
A Linked List is a dynamic data structure which contains memory blocks occupying random memory locations. The elements in the linked list are called nodes. The C programs in the following section focuses on the creation of a linked list and displays the elements(nodes) of a Linked List. The other program in the sections reads the linked list in reverse.
C Program to Create a Linked List & Display the Elements in the List
C Program to Read a Linked List in Reverse
2. C Examples on Search and Display Functions of a Linked List
The following section deals with the search and display functions which are applied to the linked list. The Search function searches for the specified element in the linked list and the Display function is used to display the elements of the linked list. The section contains programs which use the Search function to search for an element in the linked list using recursion and without using recursion. The remaining programs use the Display function to display the nodes of a linked list using recursion and without using recursion and to display the nodes of a linked list in reverse using recursion and without using recursion.
3. C Examples on Implementation of Count, Length and Print Operations on a Linked List
The following section contains C Programs which performs operations like count,finding the length, and printing the elements of the linked list. The programs count the number of occurrences of an element in the linked list using recursion and without using recursion, determines the length of the linked list using recursion and without using recursion and displays the alternate nodes in a linked list using recursion and without using recursion.
4. C Examples on Implementation of other Data Structures using Linked List
The following section provides various implementations of other data structures using linked list. It has programs to implement a Stack, to implement a Queue, to implement a Doubly Linked List, a Circular Doubly Linked List and a Binary Tree using linked list. Each node in a Doubly Linked List contains two address fields, one field stores the address of the previous node with which it is linked and the other address field stores the address of the next node to be followed. A Circular Doubly Linked List is a doubly-linked-list in which the head element’s previous pointer points to the tail element and tail element’s next pointer points to the head element. A Binary Tree is a group of nodes where each node contains a left reference, a right reference and a data element. The section also contains a C program which demonstrates the operations of a Singly Linked List. In a Singly Linked List, each node has a single link to the other node.
5. C Examples dealing with the Operations on the elements of a Linked List
This section contains C Programs which performs operations on the elements of a linked list. These operations include addition of the corresponding elements of 2 linked lists, testing if the two linked lists are same, testing if the given Singly Linked List is a palindrome, finding the number of occurrences of all the elements in a linked list. The section also involves finding the element that is common to both the linked lists and finding the largest element in a Doubly Linked List.
6. C Examples on Print, Reverse and Read Operations
This sections has C programs which perform Print, Reverse and Read operations. Print operation prints the specified contents of a linked list, Read operation reads the content of the linked list, Remove operation removes the specific contents of a linked list and Reverse operation reverses the contents of the given linked list. The programs in this section prints the middle most node of a linked list, reads a linked list in reverse, removes the duplicate elements from the linked list, reverses a given linked list and reverses the first N elements of a given linked list.
C Program to Print Middle most Node of a Linked List
C Program to Read a Linked List in Reverse
C Program to Remove Duplicates from a Linked List
C Program to Reverse a Linked List
C Program to Reverse only First N Elements of a Linked List
7. C Examples on Binary Tree Implementation using Linked List
This section deals with implementation of other data structures like Ordered Binary Tree, Balanced Binary Search Tree using a linked list. It also has programs which convert one form of linked list to another. A balanced binary tree is a tree where every leaf is “not more than a certain distance” away from the root than any other leaf. The following programs convert a Ordered Binary Tree Into a Circular Doubly Linked List, Constructs a Balanced Binary Search Tree which have the same data members as the given Doubly Linked List, Converts a Binary Tree into a Singly Linked List and converts a Singly Linked List into a Circular List.
8. C Examples on Interchange and Modify Operations
The programs in this section perform Interchange operations. They interchange the two adjacent nodes of a Circular Linked List by touching the key field and without touching the key field. The other program in the section performs the modify Operation. It modifies the given linked list such that all the even numbers appear before the odd numbers in the given linked list. The section has some special programs which solve mathematical problems like Josephus Problem using linked list and a program which performs Infinite Precision Arithmetic.