Convert a binary tree into a doubly-linked list in spiral order
Given a binary tree, convert it into a doubly-linked list following the spiral order.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a binary tree, convert it into a doubly-linked list following the spiral order.
Given a linked list of characters, recursively check if it is palindrome or not.
Given a binary search tree, find a triplet with a given sum present in it.
Given two binary search trees, merge them into a doubly-linked list in sorted order.
Given a binary search tree (BST), convert it into a height-balanced binary search tree. For a height-balanced binary search tree, the difference between the height of the left and right subtree of every node is never more than 1.
Given a linked list that stores a path formed by cells of a matrix, remove the redundant nodes in that path. The path can be both vertical and horizontal, but never diagonal.
Given a singly linked list whose nodes represent digits of a number, add a single-digit number to it.
Given a linked list, reverse every alternate group of k nodes where k is a given positive integer.
Given a linked list representation of two positive numbers, calculate and store their sum in a new list without extra space.
Given a singly linked list of integers, determine if the linked list is a palindrome or not.
Given a doubly linked list, sort it using the merge sort algorithm. Merge sort is an efficient sorting algorithm that uses the divide-and-conquer technique to sort a sequence of items.
Write an efficient algorithm to convert a ternary tree into a doubly-linked list. A ternary tree is a tree data structure in which each node has three child nodes distinguished as left, mid, and right.