ciao a tutti, cercando di implementare una struttura dati heap( heapsort ) ho avuto un problema, per semplificare il codice ho riassunto il problema che ho in piccolo programma di prova nel main
codice:
public class nod {
	Integer chiave;
	nod padre;
	nod destro;
	nod sinistro;
	
	nod(Integer chiave,nod padre,nod destro,nod sinistro){
		this.chiave=chiave;
		this.padre=padre;
		this.destro=destro;
		this.sinistro=sinistro;
		
	}
	public static void main(String arg[]){
		nod e[]=new nod[4];
		e[1]=new nod(5,null,e[2],e[3]);
		e[2]=new nod(43,e[1],null,null);
		e[3]=new nod(53,e[1],null,null);
		//e[2].chiave=65; // null pointer exception su entrambe queste righe
		//e[3].chiave=543;
		
		System.out.println(e[1].chiave);
		System.out.println(e[1].destro.chiave);// qui mi da  null pointer exception

		System.out.println(e[1].sinistro.chiave);
		

	}

}
credo che siamo lagune di teoria
potreste spiegarmi cosa sbaglio?