Miércoles 26 de noviembre de 2008 a las 14:33
otra vez molestando,,, sk tuve un error de dedo... el progrma es ordenmiento de cadenas por medio de el metodo de la burbuja y busqueda binaria,,,,,,,toy intentando pr no me sale apenas toy en el de la burbu
import java.awt.*;
import java.io.*;
class lauris{
public static void main(String args[])throws IOException{
DataInputStream stdin=new DataInputStream(System.in);
String arreglo;
int a;
System.out.println("ELEMENTOS DEL ARREGLO Y LLENADO");
System.out.println("");
System.out.print("DIGITA CUANTOS ELEMENTOS QUIERES EN TU ARREGLO: " );
arreglo=stdin.readLine();
a=Integer.parseInt(arreglo);
String nom []=new String[a];
String p,q,opcion,lu;
// int i, j,tmp,w,op;
//int v[]=new int [a];
String l[]=new String[a];
// int n=v.length;
String tmpStr="";
System.out.println("");
for (int x=0;x<nom.length;x++){
System.out.print(" nombre: " );
q=stdin.readLine();
nom[x]=(q);
}
}
public void burbuja(String[]nom,int n){
int temp,aux;
for(int i=0;i<=n-2;i++){
aux=i;
for(int j=i;j<=n-1;j++){
if(nom[j]<nom[aux])
aux=j;
}
temp=nom;
nom=nom[aux];
nom[aux]=temp;
}}}
como ves