rendered paste body#include<iostream>#include<vector>using namespace std;template<class t>class node{public: t dato; node<t> * pson[2]; //2 punteros a sus hijos node(t d) { dato = d; pson[0] = pson[1] = NULL; } };template<class t>class binary_tree{ node<t> * proot; public: binary_tree() { proot = NULL; } void add (t dat) { node <t> **p ; if (find(dat,p)) return; *p = new node<t>(dat); } bool find(t dat,node<t> ** &p) { p =&proot; while(*p) { if((*p)->dato==dat)return true; p= &((*p)->pson[(*p)->dato<dat]); } return false; } void preorden(node<t> * p = proot ) { if(!p) return; cout<<p->dato<<endl; preorden(p->pson[0]); preorden(p->pson[1]); } };