This project implements a singly linear linked list data structure in C. It provides basic operations such as insertion, deletion, sorting, and displaying elements of the list.
The program uses a linked list structure consisting of nodes, where each node contains an integer value and a reference to the next node. The main operations supported by the program are:
-
Insertion:
- Insert an element at the beginning of the list.
- Insert an element at the end of the list.
- Insert an element after a specific element in the list.
-
Deletion:
- Delete the first element of the list.
- Delete the last element of the list.
- Delete a specific element from the list.
-
Search:
- Search for an element with a specified value in the list.
-
Sorting:
- Sort the elements of the list in ascending order based on their values.
-
Display:
- Display all the elements of the list.
To compile and run the program, you need a C compiler such as GCC. Follow these steps:
- Clone the repository:
git clone https://github.com/steepcloud/singly-linear-linked-list.git
- Navigate to the project directory:
cd singly-linear-linked-list/Singly Linear Linked List/Singly Linear Linked List
- Compile the source code:
gcc SLLL.c -o linked_list
- Run the program:
./linked_list
After running the program, you will be presented with a menu that allows you to perform various operations on the linked list. Use the number keys to select an option and press Enter.
Insertion: Choose option 1 to access the insertion submenu. Then, follow the prompts to insert elements at the beginning, end, or after a specific element in the list.
Deletion: Choose option 2 to access the deletion submenu. Then, follow the prompts to delete the first element, last element, or a specific element from the list.
Search: Choose option 3 to search for an element with a specified value in the list. Enter the value to search for, and the program will indicate whether the element was found or not.
Show: Choose option 4 to display all the elements of the list.
Sort: Choose option 5 to sort the elements of the list in ascending order based on their values.
Exit: Choose option 0 to exit the program.
Contributions to this project are welcome. If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository .