pravocodes / Hacktoberfest2024

26 stars 249 forks source link

merged two sorted linked lists. #101

Closed shalupatidar22 closed 3 weeks ago

shalupatidar22 commented 1 month ago

This pull request introduces a function that merges two sorted singly linked lists into one sorted linked list. The key changes include:

Node Structure: Defines the structure for linked list nodes with data and next pointers. Linked List Operations: create() and create2(): Initialize two linked lists from two separate arrays. merge(): Merges two pre-sorted linked lists into a new sorted linked list. display(): Recursively displays the contents of the linked list.