c++ - Would making a binary search tree out of a struct over a class node be bad? -


I'm not sure that I should .. or use any structure to build a binary search tree, The second option is to make the nodes out of a different node class with data, which is better than the left and right? And why?

BST

  Template & lt; Typename T & gt; Class BST: Public Searches ADT & lt; T & gt; {Public: BST (zero) {head = null; Numbers = 0; } Virtual ~ BST (zero); Virtual int loadFromFile (string filename); Virtual Zero Clear (Zero); Virtual zero entry entry (t info); Virtual Zero Deletion Entry (T information); Is virtual bolt (t information); Virtual difference numbers (zero); // AVL Int BST and lieutenant; T & gt; :: Required to compare height (T_Node * TPTR); Protected: struct t_node {string data; T_Node * L; T_Node * R; }; Int numnodes; T_node * head; T_Node * CPR; // current pointer T_Node * PPTR; // Basic pointer T_Node * TPTR; // temporary pointer}; // Class BST End  

Better to create two sections, one BST And for the second node, they are two different segments. The node is a simple abstract, whose main purpose is to capture the data required to define a BST. BST is an abstraction of a high level. It is a collection class with its sleeves and expectations.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -