JFLORES99

Untitled

Dec 8th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. public static String alinea5(MorseTree tree, Morse a , Morse b){
  2. String common="";
  3. return alinea5b(tree.root(), a,b,common);
  4. }
  5.  
  6.  
  7.  
  8. private static String alinea5b(Node<Morse> node, Morse a, Morse b,String common){
  9. if(node==null
  10. ||node.getElement()==a
  11. ||node.getElement()==b
  12. ||( a.compareTo(node.getElement() ) ) != ( b.compareTo(node.getElement() ) )){
  13. return common;
  14. } else{
  15. if(a.compareTo(node.getElement())<0 ){
  16. common = common + ".";
  17. return alinea5b( node.getLeft(),a,b,common);
  18. }else{
  19. common = common + "_";
  20. return alinea5b( node.getRight(),a,b,common);
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment