Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. public void insertNew(String nome,String sigla,int min,int max){
  2. root = recInsert(root,nome,sigla);
  3. for(int i=min;i<=max;i++){
  4. root.pais.rating.insert(new Rating(i,0));
  5. }
  6. }
  7. public void insert(String nome,String sigla){
  8. root = recInsert(root,nome,sigla);
  9. }
  10. private AVLCountryNode recInsert(AVLCountryNode root,String nome,String sigla){
  11. if(root==null)return new AVLCountryNode(nome,sigla);
  12. else if(root.pais.nome.toUpperCase().compareTo(nome.toUpperCase())<0)
  13. root.left = recInsert(root.left, nome, sigla);
  14. else if(root.pais.nome.toUpperCase().compareTo(nome.toUpperCase())>0)
  15. root.right = recInsert(root.right, nome, sigla);
  16. else
  17. return root;
  18. return balance(root);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement