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 …
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.
Given two linked lists, merge their nodes together to make one list, taking nodes alternately between the two lists. If either list runs out, all the nodes should be taken from the other list.
Given a linked list, split its into two lists where each list containing alternating elements from the original list. The elements in the new lists may be in any order.
Rearrange the given linked list such that every even node will be moved to end of the list in reverse order.
Given a linked list, move front node of it to the front of the another given list.
Given a linked list sorted in increasing order, write a function which removes any duplicate nodes from the list by traversing the list only once.
Given a list, split it into two sublists — one for the front half, and one for the back half. If the number of elements is odd, the extra element should go in the front list.
Write a function which given a list, rearranges its nodes so they are sorted in increasing order.
Given a list that is sorted in increasing order, and a single node, insert the node into the correct sorted position in the given list. The function should take an existing node, and just rearranges pointers to insert it into the list.
Write a Pop() function that is the inverse of Push(). Pop() takes a non-empty list, deletes the head node, and returns the head node’s data.
Write a function that takes a linked list, deallocates all of its memory and sets its head pointer to nullptr (the empty list).
Write a function that takes a singly linked list and returns a complete copy of that list.
We have discussed about the linked list data structure which is dynamic in nature (the memory is allocated during the run time). Now the question that might be on a few peoples minds is – can a linked link be implemented statically as well? This post tries to answer this question.