Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added linked_list_sort to the sorting folder #2912

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

SivaPA08
Copy link

This contribution implements a C++ program to sort a singly linked list using the Merge Sort algorithm. The program provides the following functionality:

mid function: Identifies the middle node of the linked list using the slow and fast pointer approach.
mg function: Merges two sorted linked lists into a single sorted list.
sortList function: Implements the Merge Sort algorithm to sort the linked list.
push function: Adds a new node with a specified value to the front of the linked list.
Main function: Demonstrates the program by creating a linked list, sorting it, and displaying the sorted result.
This code serves as an educational example of how Merge Sort can be applied to linked lists, showcasing important concepts like recursion, pointer manipulation, and divide-and-conquer strategies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant