binary Insertion method, help

0

binary insert with two errors.

import java.util.Scanner;
public class Main
{
    public static void main(String[]kyuu)
    {
      Scanner teclado = new Scanner(System.in);
      int[] x = {23,44,12,-19,98,102,56,36,21,33,67};
      Main hola = new Main();
      //ordena la matriz de numeros
      hola.ordenar(x);
      //imprime la matriz de numeros
      hola.imprimir(x);
      int busqueda=-19;
      hola.busquedaBinaria(x, busqueda);
    }

    public void ordenar(int[] x)
    {
        for(int i = 0; i < x.length; i++)
        {
          int menor = this.inferior(x, i);
          int temp = x[i];
          x[i] = x[menor];
          x[menor] = temp;
        }
    }

    private int inferior(int[] x, int  inf)
    {
      int menor = inf;
      for(int i = inf; i < x.length; i++)
      {
      if(x[i] < x[menor])
       {
      menor = i;
       }
      }
    }
}

and I could also explain differences between binary and direct and sort ... thank you ..

    
asked by Enrique G. 11.11.2016 в 18:42
source

1 answer

1

You have not defined the methods imprimir and busquedaBinaria in your class Main (I only see ordenar e inferior ). So, obviously the compiler does not understand these sentences:

hola.imprimir(x);
// ...
hola.busquedaBinaria(x, busqueda);
    
answered by 11.11.2016 в 18:47