i have a csv(excel outputted) file and i have loaded all the data into an array, and i want to know how to use the array to search the data in the array using binary search tree.
any ideas on how to do this??
i have made a binary search tree class!!
here is my code for loading into the array...
public void load(Warehouse_Item[] data)
{
int i = 0;
String brand;
int weight;
String key;
String model;
double price;
String line = null;
try {
BufferedReader in = new BufferedReader(new FileReader("default.csv"));
while ((line = in.readLine()) != null) {
String[] fields = line.split(",");
key = fields[0];
brand = fields[1];
model = fields[2];
weight = Integer.parseInt(fields[3]);
price = Double.parseDouble(fields[4]);
data[i] = new Warehouse_Item(key, brand, model, weight, price);
i++;
}
}
catch (IOException e) {
System.out.println("ERROR: There was a problem with the file!");
e.printStackTrace();
}
please help!!