Question: HELP IN JAVA: I want to creata binary search tree of person objects Here is the java class dor person objects: public class Person {
HELP IN JAVA:
I want to creata binary search tree of person objects
Here is the java class dor person objects:
public class Person {
private String firstName; private String lastName; private String birthDate; private String phoneNumber;
public Person(String firstName, String lastName, String birthDate, String phoneNumber) { this.firstName = firstName; this.lastName = lastName; this.birthDate = birthDate; this.phoneNumber = phoneNumber; }
public String getFirstName() { return firstName; }
public void setFirstName(String firstName) { this.firstName = firstName; }
public String getLastName() { return lastName; }
public void setLastName(String lastName) { this.lastName = lastName; }
public String getBirthDate() { return birthDate; }
public void setBirthDate(String birthDate) { this.birthDate = birthDate; }
public String getPhoneNumber() { return phoneNumber; }
public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } public boolean compareTo(Person another) { if (lastName.equals(another.getLastName())) return true; else return false; } }
need help creatign a method that will take person objects and create a binary search tree
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
