Help with Homework | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help with Homework

Write a program to implement a binary tree having 15 nodes for storing character data type. Also implement traversal operations.

24th Apr 2018, 2:20 PM
Antonio Ramirez
Antonio Ramirez  - avatar
8 Answers
+ 10
Please post your attempts at solving the problem.
24th Apr 2018, 2:22 PM
Hatsy Rei
Hatsy Rei - avatar
+ 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
24th Apr 2018, 2:49 PM
Hatsy Rei
Hatsy Rei - avatar
+ 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 };
24th Apr 2018, 2:29 PM
Hatsy Rei
Hatsy Rei - avatar
+ 5
and please don't create multiple threading this question
24th Apr 2018, 2:27 PM
Awele Omeligwe
Awele Omeligwe - avatar
0
Will do
24th Apr 2018, 2:22 PM
Antonio Ramirez
Antonio Ramirez  - avatar
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 ); };
24th Apr 2018, 2:27 PM
Antonio Ramirez
Antonio Ramirez  - avatar
0
Is there a tutorial on this on this app
24th Apr 2018, 2:38 PM
Antonio Ramirez
Antonio Ramirez  - avatar
0
Thnxs
24th Apr 2018, 2:52 PM
Antonio Ramirez
Antonio Ramirez  - avatar