Binary search tree and Array ?
Hi. I am trying to write a code which will read details from a file.
Than using a binary search tree, I will check whether the search item is on the list. lets say, i read a customer file which has customer details number,name,etc
cust no: 753
my understanding is, before i can do a binary search the data has to be on an array and sorted. Then i can add this to a tree and do the search. is this correct ? if so, seaching for, say, cust no is Ok, but where do i keep the data for the other details (name ,city)? In same binary tree or a seperate one ?
pls mention the prog. language ur goin to use...if ur using 'c' then u can for struct datatype...similarly if ur using c++ or java u can go for 'class' for storing all the values encapsulated in a single object....
Just to clarify, i am programming in Java.
..if you are using a BST the last thing you want to do is sort the data unless you are sorting it randomly... sorry if this is not your question :P
it depends on the BST.. if you write one that stores your data type you could throw all the data in one tree but sort by the customer number.