Category: Linked List

Intersection of two given sorted linked lists

Given two lists sorted in increasing order, create and return a new list representing the intersection of the two lists. The new list should be made with its own memory — the original lists should not be changed.  

Merge Sort for Singly Linked List

Given a linked list, sort it using merge sort algorithm.     Merge sort is an efficient, general-purpose sorting algorithm which produces a stable sort, which means that the implementation preserves the input order of equal elements in the sorted output. Mergesort is a comparison sort, i.e. it can sort items of any type for …

Merge given sorted linked lists into one

Write a function that takes two lists, each of which is sorted in increasing order, and merges the two together into one list which is in increasing order and return it.