Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 6th, 2002, 07:08 AM
khfter khfter is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 0 khfter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy 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:1882
Mr Smith
los Angeles
cust no: 753
Ms Miriaz
new york

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 ?

Thank you

Reply With Quote
  #2  
Old May 6th, 2002, 11:48 AM
aabha aabha is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Location: India
Posts: 7 aabha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to aabha
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....

Reply With Quote
  #3  
Old May 6th, 2002, 05:23 PM
khfter khfter is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 0 khfter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Just to clarify, i am programming in Java.

Thank you

Reply With Quote
  #4  
Old May 6th, 2002, 05:33 PM
akaScream akaScream is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Posts: 0 akaScream User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
..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

Quote:
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 ?


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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Binary search tree and Array ?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap