private double medianOfMedians(ArrayList<double[]> puntos, int axis,int start,int end){
		switch (end-start+1){
		case 1: return puntos.get(start)[axis];
		case 2: return (puntos.get(start)[axis]+puntos.get(start+1)[axis])/2;
		case 3: return medianOfThree(puntos, axis,start);
		case 4: return medianOfFour(puntos, axis,start);
		case 5: return medianOfFive(puntos,axis,start);
		default:
			{
				ArrayList<double[]> medians=new ArrayList<double[]>();
				

				for(int j=start; j<=end; j+=5){
					
					double[]pto = new double[2];
					pto[axis]=medianOfMedians(puntos, axis,j,Math.min(j+4, end));
					medians.add(pto);
					
				}
				
				return medianOfMedians(medians, axis,0,medians.size()-1);
			}
		}

	}