how can I read a txt file and insert the values that are stored in the txt file into my binary tree. lets say the txt file has 1,2,3,4,5 and these values should now be inserted into my binary tree. Duplicate key values should be discarded when trying to insert them.
Hello guys, how can I read a txt file and insert the values that are stored in the txt file into my binary tree. lets say the txt file has 1,2,3,4,5 and these values should now be inserted into my binary tree. Duplicate key values should be discarded when trying to insert them.
// Simple program to create a BST of integers and search an element in it
#include<iostream>
#include <fstream>
#include <string>
using namespace std;
//Definition of Node for Binary search tree
struct node {
int data;
node* left;
node* right;
};