摘要: Given a binary search tree and a node in it, find the in-order successor of that node in the BST. Note: If the given node has no in-order successor in 阅读全文
posted @ 2017-03-24 11:35 CodesKiller 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, ex 阅读全文
posted @ 2017-03-24 08:39 CodesKiller 阅读(153) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty binary search tree and a target value, find the value in the BST that is closest to the target. Note: Given target value is a floati 阅读全文
posted @ 2017-03-24 07:13 CodesKiller 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty binary search tree and a target value, find k values in the BST that are closest to the target. Note: Given target value is a floati 阅读全文
posted @ 2017-03-24 02:57 CodesKiller 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ BST's 阅读全文
posted @ 2017-03-24 01:44 CodesKiller 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the n 阅读全文
posted @ 2017-03-24 01:10 CodesKiller 阅读(187) 评论(0) 推荐(0) 编辑