how to read list of name from text file into a binary search tree?
As the title, how to read data from text file and load into a BST? suppose text file have name and phone number which name and phone number is a string, so when function invoked should read data from text file and load into a BST
having problem with this, is the "add" suppose a function? or have any standard library command to replace it?
public void readDataFile() // read data from text fiel and load into BST
String fileName = "phonebook.txt"; // name of thr file
Scanner fromFile = null;
fromFile = new Scanner(new File(fileName)); // read from file phonebook.txt
System.out.println("Error : " +e);
System.out.println("Unable to open file " + fileName);
DataFile tree = new DataFile();
String line = fromFile.nextLine(); // reads each line from the text file and stores it in line.
tree.add(line); // please help me this part