0

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!!

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by ~s.o.s~
0

What exactly is the problem here? You want to test out your binary tree? Also, is it required that you create one and not use the set data structure present in the Java standard library?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.