Problème de construction d'un arbre binaire

Fermé
lynajar Messages postés 37 Date d'inscription dimanche 15 décembre 2019 Statut Membre Dernière intervention 9 février 2021 - 7 sept. 2020 à 12:59
Bonjour,
j'ai construit un arbre biinBoubnad wafaaaire et j'ai afficher l'arbre en prefix, tout marche bien,
la deuxieme étape je veux modifier l'arbre en modifiant la position de quelques noeud de l'arbre, j'ai construi un code mais j'ai remarqué que le code n'entre pas à l'interieur d'une condition malgré que la condition est vrai

public void deplace(double[][] matrix, int i,int j) {

    System.out.print("[input: "+j+"]");
    if(root == null) {
        this.root = new BstNode(matrix,j);
        System.out.println(" -> inserted: "+j);
        return;
    }

    DeplaceNode(this.root, matrix, i,j);
    System.out.print(" -> inserted: "+j);
    System.out.println();
}

private BstNode DeplaceNode(BstNode root, double [][]matrix, int i, int j)
{
	int k=0;
	BstNode tmpNode = null;
    
    if(matrix[i][j]!=0) // la condition est vrai
    {
    	if(max(L,matrix[i][j])==matrix[i][j])  // la condition est vrai malgré qu'il execute 
                                                             //corectement mais il concidére que la condition est fausse
	  {
			  if(s[j]!=0)  //
			  {
				  {
					  if(this.getRoot().getRight()==null)
					  {
						  this.root.setRight(new BstNode(matrix,j));
						  s[j]=0;
						  return root.getRight();
					  }
					  else
					  {
						  System.out.println("L");
						  tmpNode=(this.getRoot().getRight());
						  s[k]=0;
					  }
				  }
			  }
				  
		  
    	
    	
	  }	
    	
    }
	
	
    else
    	return root;
	
	
	//return DeplaceNode(tmpNode, matrix, i,j);
    return this.root;
}



Configuration: Windows / Chrome 85.0.4183.83