Amazon Interview Question
SDE-3sTeam: Phone Interview
Country: United States
public class Employee{
String name;
Employee manager;
public int hashCode(){
return name.hashCode();
}
public String toString(){
String ptr= name;
Employee mgr =this.manager;
while (manager !=null ) {
ptr= prt + manager.name;
manager= manager.manager;
}
System.out.println("Hirearchy :" + ptr);
}
public static main(string[] args){
//create Employee object from the CSV file and put it in the hashmap, fetch any employee that you want his hirarchy to be printed.
System.out.println (employee.toString());
}
}
- Adjecency List
- tnutty2k8 August 01, 2017- BFS