Académique Documents
Professionnel Documents
Culture Documents
Scanner;
import java.util.ArrayList;
System.out.print("----------ENTER DATA----------");
in.nextLine();
System.out.print("\n"+sh.getBrand());
}
//Insertion sort
insertionSort(shoeList);
array[i] = sh.getBrand();
System.out.print("\n"+sh.toString());
}
//Binary search
System.out.print("\n\nEnter brand to search : ");
String x = in.nextLine();
if (result == -1)
System.out.println("\nElement not present");
else
{
System.out.print("\n"+sh.toString());
}
System.out.print("\nindex : "+i+"\t"+sh.toString());
}
System.exit(0);
}
while (i>=0)
{
if (key.getBrand().compareTo(inputArray.get(i).getBrand()) > 0)
{
break;
}
while (l <= r)
{
int m = l + (r - l) / 2;
int res = x.compareTo(arr[m]);
if (res == 0)
return m;
if (res > 0)
l = m + 1;
else
r = m - 1;
}
return -1;
}
}
public class Shoes
{
public String brand;
public int size;
public Shoes()
{
brand = null;
size = 0;
}
----------ENTER DATA----------
Enter brand : puma
Enter size (EUR) : 40
ASSIGNMENT 1
GROUP : A4CS1104D