Both Arrays and Linked List can be used to store linear data of similar types, but they both have some advantages and disadvantages over each… Read More »

## Reverse a Linked List in groups of given size | Set 1

Given a linked list, write a function to reverse every k nodes (where k is an input to the function). Example: Input: 1->2->3->4->5->6->7->8->NULL, K =… Read More »

## 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 some other algorithms (such as quicksort)… Read More »

Two Linked Lists are identical when they have same data and arrangement of data is also same. For example Linked lists a (1->2->3) and b(1->2->3)… Read More »

## Merge two sorted linked lists

Write a SortedMerge() function that takes two lists, each of which is sorted in increasing order, and merges the two together into one list which… Read More »

## Alternating split of a given Singly Linked List | Set 1

Write a function AlternatingSplit() that takes one list and divides up its nodes to make two smaller lists ‘a’ and ‘b’. The sublists should be… Read More »

## Delete alternate nodes of a Linked List

Given a Singly Linked List, starting from the second node delete all alternate nodes of it. For example, if the given linked list is 1->2->3->4->5… Read More »

## Intersection of two 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… Read More »

## Delete a node in a Doubly Linked List

Doubly Link List Set 1| Introduction and Insertion Write a function to delete a given node in a doubly linked list. (a) Original Doubly Linked… Read More »

## Pairwise swap elements of a given linked list

Given a singly linked list, write a function to swap elements pairwise. Input : 1->2->3->4->5->6->NULL Output : 2->1->4->3->6->5->NULL Input : 1->2->3->4->5->NULL Output : 2->1->4->3->5->NULL Input… Read More »

## Move last element to front of a given Linked List

Write a function that moves the last element to the front in a given Singly Linked List. For example, if the given Linked List is… Read More »

## Practice questions for Linked List and Recursion

Assume the structure of a Linked List node is as follows. filter_none edit close play_arrow link brightness_4 code struct Node {   int data;   struct Node… Read More »

## Split a Circular Linked List into two halves

Original Linked List Result Linked List 1 Result Linked List 2 If there are odd number of nodes, then first list should contain one extra.… Read More »

## Reverse a Doubly Linked List

Write a C function to reverse a given Doubly Linked List See below diagrams for example. (a) Original Doubly Linked List (b) Reversed Doubly Linked… Read More »

## Remove duplicates from an unsorted linked list

Write a removeDuplicates() function which takes a list and deletes any duplicate nodes from the list. The list is not sorted. For example if the… Read More »