[DSA] Exercises for circular linked list
Here are some exercises for you to practice about circular linked list:
- Write a function to find the middle node of a circular linked list. If there are two middle nodes, return the second middle node.
- Write a function to check if a circular linked list is palindrome.
- Write a function to find the node at the beginning of a loop in a circular linked list.
- Write a function to split a circular linked list into two halves.
- Write a function to check if two circular linked lists are identical.
- Write a function to rotate a circular linked list by k nodes.
- Write a function to reverse a circular linked list.
- Write a function to find the sum of two circular linked lists.
- Write a function to remove duplicates from a circular linked list.
- Write a function to insert a node in a sorted circular linked list.
- Write a function to delete every nth node in a circular linked list.
- Write a function to merge two sorted circular linked lists.
- Write a function to insert a node at the end of a circular linked list.
- Write a function to reverse every k nodes in a circular linked list.
- Write a function to find the largest element in a circular linked list.
- Write a function to find the smallest element in a circular linked list.
- Write a function to delete a node with a given value from a circular linked list.
- Write a function to check if a circular linked list contains a loop.
- Write a function to remove the last node from a circular linked list.
- Write a function to add two circular linked lists of different lengths.
- Write a function to check if a circular linked list is sorted in ascending order.
- Write a function to check if a circular linked list is sorted in descending order.
- Write a function to find the length of a circular linked list.
- Write a function to delete all nodes with even values in a circular linked list.
- Write a function to delete all nodes with odd values in a circular linked list.
- Write a function to find the second largest element in a circular linked list.
- Write a function to find the second smallest element in a circular linked list.
- Write a function to find the sum of all nodes in a circular linked list.
- Write a function to find the product of all nodes in a circular linked list.
- Write a function to insert a node at a given position in a circular linked list.
- Write a function to find the difference between the sum of nodes at odd positions and the sum of nodes at even positions in a circular linked list.
- Write a function to insert a node in a sorted circular linked list in such a way that the resulting list remains sorted.
- Write a function to remove all occurrences of a given value from a circular linked list.
- Write a function to find the maximum difference between two consecutive elements in a circular linked list.
- Write a function to reverse a circular linked list using recursion.
- Write a function to sort a circular linked list in ascending order.
- Write a function to sort a circular linked list in descending order.
- Write a function to find the median of a circular linked list.
- Write a function to split a circular linked list into two halves at the midpoint.
- Write a function to find the kth smallest element in a circular linked list.
- Write a function to move the last node to the front of a circular linked list.
- Write a function to move the first node to the end of a circular linked list.
- Write a function to swap the first and last nodes of a circular linked list.
- Write a function to check if a circular linked list is a palindrome.
- Write a function to remove duplicate nodes from a sorted circular linked list.
- Write a function to split a circular linked list into two halves based on the sum of nodes in each half.
- Write a function to find the node at the beginning of a loop in a circular linked list.
- Write a function to rotate a circular linked list by k nodes.
- Write a function to convert a circular linked list to a singly linked list.
- Write a function to find the length of the longest palindrome in a circular linked list.
- Write a function to find the smallest window in a circular linked list that contains all the elements of a given set.
- Write a function to flatten a circular linked list that contains nested lists (each node in the list can be a value or a list).
- Write a function to find the largest sum subarray in a circular linked list.
- Write a function to remove the last n nodes from a circular linked list.
- Write a function to find the largest node in a circular linked list.
- Write a function to find the smallest node in a circular linked list.
- Write a function to merge two sorted circular linked lists into a single sorted circular linked list.
- Write a function to find the longest path in a circular linked list with weighted edges.
- Write a function to count the number of times a given value appears in a circular linked list.
- Write a function to check if a circular linked list is sorted in non-decreasing order.
Source: chatGPT
Không có nhận xét nào