Given a node from a cyclic linked list which has been sorted, write a function to insert a value into the list such that it remains a cyclic sorted list. The given node can be any single node in the list.

# Category Archives: linked list

# Convert Binary Search Tree (BST) to Sorted Doubly-Linked List

Convert a BST to a sorted circular doubly-linked list in-place. Think of the left and right pointers as synonymous to the previous and next pointers in a doubly-linked list.

# Convert Sorted List to Balanced Binary Search Tree (BST)

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.

# Detecting a Loop in a Singly Linked List

Given a singly linked list, find if there exist a loop.

# Splitting Linked List

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. So FrontBackSplit() on the list {2, 3, 5, 7, 11} should yield the two lists {2, 3, 5} and […]