BinaryTree

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include "binarytree.h" using namespace std; // class binarytree<int> m(100,new class binarytree<int>(20),new class binarytree<int>); class binarytree m(100,new class binarytree(20),new class binarytree); int main() { cout<<m.d<<"\n"; cout<<m.l->d<<"\n"; cout<<m.r->d<<"\n"; blance(); blance(empenty); return 0; }
using namespace std; //template <typename T> /* class binarytree{ public: T d; class binarytree<T> *l; class binarytree<T> *r; binarytree(T in=0,class binarytree<T> *l=NULL,class binarytree<T> *r=NULL){ this->d=in; this->l=l; this->r=r; } }; */ // /* class binarytree{ public: int d; class binarytree *l; class binarytree *r; binarytree(int in=0,class binarytree *l=NULL,class binarytree *r=NULL){ this->d=in; this->l=l; this->r=r; } }; // */ class binarytree empenty; bool blance(class binarytree in=empenty,bool LR=true){ if (in.l==NULL||in.r==NULL){ cout<<"Error:\nThe input Binary Tree of the BT.blance() have no left subtree or right subtree;\n"; return false; } if (LR){ } return true; }
Editor Settings
Theme
Key bindings
Full width
Lines