109. Convert Sorted List to Binary Search Tree
109. Convert Sorted List to Binary Search Tree
Description
Given the head
of a singly linked list where elements are sorted in ascending order , convert it to a height-balanced binary search tree.
109. Convert Sorted List to Binary Search Tree
Given the head
of a singly linked list where elements are sorted in ascending order , convert it to a height-balanced binary search tree.
449. Serialize and Deserialize BST
Serialization is converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment.
108. Convert Sorted Array to Binary Search Tree
Given an integer array nums
where the elements are sorted in ascending order , convert it to a height-balanced binary search tree.
1008. Construct Binary Search Tree from Preorder Traversal
Given an array of integers preorder, which represents the preorder traversal of a BST (i.e., binary search tree), construct the tree and return its root.
Given the root
of a binary search tree (BST) and an integer target
, split the tree into two subtrees where the first subtree has nodes that are all smaller or equal to the target value, while the second subtree has all nodes that are greater than the target value. It is not necessarily the case that the tree contains a node with the value target
.
671. Second Minimum Node In a Binary Tree
Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two
or zero
sub-node. If the node has two sub-nodes, then this node’s value is the smaller value among its two sub-nodes. More formally, the propertyroot.val = min(root.left.val, root.right.val)
always holds.
669. Trim a Binary Search Tree
Given the root
of a binary search tree and the lowest and highest boundaries as low
and high
, trim the tree so that all its elements lies in [low, high]
. Trimming the tree should not change the relative structure of the elements that will remain in the tree (i.e., any node’s descendant should remain a descendant). It can be proven that there is a unique answer .
510. Inorder Successor in BST II
Given a node
in a binary search tree, return the in-order successor of that node in the BST. If that node has no in-order successor, return null
.