| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12279 | Binary Search Tree With Iterator (Preorder) |
|
Description
* 5/19 update main function.
Try to visit binary search tree in preorder ~
This is simple problem, but you should implement iterator to accept this problem.
Here is a template, you should implement all member functions in class iterator.
#include "function.h"
struct Content
{
// something
};
Iterator::Iterator(Node *root)
{
// data = new Content;
}
Iterator::Iterator(const Iterator &other)
{
}
Iterator::~Iterator()
{
}
int Iterator::operator*() const
{
}
bool Iterator::operator!=(const Iterator &it) const
{
}
void Iterator::operator++(int)
{
}
Input
First line has 2 number N, Q
N it list length, Q is garbage value
Next line has N intergers, all values will insert to binary search tree in input order.
* 2 <= N <= 2000
Output
Output all node values in preorder
Some garbage value will be added in the result to prevent some hack skill :)