avinash201199 / avinash201199/DSA-Questions

Merge two Sorted Linked Lists

Open
#162 4 comments 0 reactions 2 assignees Claimed by @esheetaparulekar View on GitHub
hacktoberfest
Dominant language
C++
Stars
88
Forks
167
PR merge metrics
No merged PRs in 30d

Description

Hello I'm a participant in Hacktoberfest 2021. I want to add this problem with the solution in C++ in your repo Linked List.
Please assign me to this.

**Problem Statement:**
You have been given two sorted(in ascending order) singly linked lists of integers.
Write a function to merge them in such a way that the resulting singly linked list is also sorted(in ascending order) and return the new head to the list.

**Consider:**
While specifying the list elements for input, -1 indicates the end of the singly linked list and hence, would never be a list element.

**Sample Input 1:**
2 5 8 12 -1
3 6 9 -1

**Sample Output 1:**
2 3 5 6 8 9 12

**Sample Input 2:**
10 40 60 60 80 -1
10 20 30 40 50 60 90 100 -1

**Sample Output 2:**
10 10 20 30 40 40 50 60 60 60 80 90 100

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.