Skip to content

Tag Archives: Linked-List-Sorting

Given the head of a Linked List of size N, consisting of binary integers 0s and 1s, the task is to sort the given linked… Read More
Given a doubly-linked list containing N nodes, where each node is at most K away from its target position in the list, the task is… Read More
Given a singly linked list, sort it using bubble sort by swapping nodes. Example: Input: 10->30->20->5 Output: 5->10->20->30 Input: 20->4->3 Output: 3->4->20 Recommended: Please try… Read More
Given an unsorted Linked List of integers. The task is to sort the Linked List into a wave like Line. A Linked List is said… Read More
Given a singly linked list of integers, the task is to sort it using iterative merge sort.    Recommended: Please solve it on “PRACTICE” first,… Read More
Prerequisite :Merge Sort and Quick Sort Quick sort is an internal algorithm which is based on divide and conquer strategy. In this: The array of… Read More
Sort the given doubly linked list using bubble sort. Examples:   Input : 5 4 3 2 1 Output : 1 2 3 4 5 Input :… Read More
Sort the given biotonic doubly linked list. A biotonic doubly linked list is a doubly-linked list which is first increasing and then decreasing. A strictly… Read More
Prerequisite: Merge Sort for Linked Lists Merge sort is often preferred for sorting a linked list. The slow random-access performance of a linked list makes… Read More
Given a Linked List, task is to check whether the Linked List is sorted in Descending order or not?  Examples :   Input : 8 ->… Read More
Given an array of size N and a Linked List where elements will be from the array but can also be duplicated, sort the linked… Read More
Given a linked list containing n nodes. The problem is to rearrange the nodes of the list in such a way that the data in… Read More
Given a linked list of 0s, 1s and 2s, sort it.Examples: Input : 2->1->2->1->1->2->0->1->0 Output : 0->0->1->1->1->1->2->2->2 The sorted Array is 0, 0, 1, 1,… Read More
This a common question asked in DS interviews that despite of better worst case performance of quick sort, quicksort is considered better than mergesort. There… Read More