0
Help with Homework
Write a program to implement a binary tree having 15 nodes for storing character data type. Also implement traversal operations.
8 Réponses
+ 10
Please post your attempts at solving the problem.
+ 7
Antonio Ramirez We do have a lesson briefly explaining the structure and concept of binary trees:
https://www.sololearn.com/learn/322/?ref=app
but to get a code sample for reference purposes, you need to go for this:
https://www.cprogramming.com/tutorial/lesson18.html
+ 6
Create a class BinaryTree. This class should contain the methods you written, and also the appropriate attributes:
class BinaryTree
{
private: Node* root;
public: // the functions you written
};
+ 5
and please don't create multiple threading this question
0
Will do
0
#include <iostream>
#include namespace std;
struct Node {
int Data;
Node* Left;
Node* Right;
};
Node* Find( Node* node, int value )
{
if( node == NULL )
return NULL;
if( node->Data == value )
return node;
if( node->Data > value )
return Find( node->Left, value );
else
return Find( node->Right, value );
};
void Insert( Node* node, int value )
{
if( node == NULL ) {
node = new Node( value );
return;
}
if( node->Data > value )
Insert( node->Left, value );
else
Insert( node->Right, value );
};
0
Is there a tutorial on this on this app
0
Thnxs