# Tag: Tree

1. ## Leetcode 173 Binary Search Tree Iterator

Leetcode 173 Binary Search Tree Iterator 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 next smallest number in the BST. Note: next() and hasNext() should run in average O(1) time and…

2. ## Leetcode 117 Populating Next Right Pointers in Each Node II

Problem 117 Populating Next Right Pointers in Each Node II Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tree could be any binary tree? Would your previous solution still work? Note: You may only use constant extra space. For example, Given the following…

3. ## Leetcode 226 Invert Binary Tree

As I have already build this blog, I will move my notes of Leetcode problem from my Evernote. But it would take time. Problem 226 Invert Binary Tree Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 Trivia: This problem…