Nemůžu přijít na to, jak psát strom binárního vyhledávání podat rekurzivně. Otevřu BufferWriter s souboru wrtie i ve třídě Tree. pak pošlu BufferWriter do třídy Node procházet strom nezbytného a zapisovat do souboru. Ale to nefunguje.
public void write(String filePath)
{
if(root != null) {
try {
BufferedWriter out = new BufferedWriter(new FileWriter(filePath));
root.write(out);
} catch (IOException e) {
}
}
}
public void write(BufferedWriter out)
{
if (this.getLeft() != null) this.getLeft().write(out);
out.write(this.data());
if (this.getRight() != null) this.getRight().write(out);
}













