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

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.