My data structure assignment about binary search tree.i dunno how to do...

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2009
Posts: 4
Reputation: iris88 is an unknown quantity at this point 
Solved Threads: 0
iris88 iris88 is offline Offline
Newbie Poster

My data structure assignment about binary search tree.i dunno how to do...

 
-2
  #1
Oct 17th, 2009
THis is my assignment question...
______________________________________________________
MyCar Sdn. Bhd. sells new cars. The manager of MyCar wants to develop a system that can do storing, searching, modifying, deleting and printing all information of all selling cars by the company. As a programmer, you are required to develop a system that can do all the operations stated. All the cars information must be stored in a form of binary search tree.

The declaration of nodes for binary search tree that stores data of ‘char’ type is as follows:-

typedef char ItemType;
struct TreeNode
{
ItemType info;
TreeNode* left;
TreeNode* right;
}

Modify the declaration so that the nodes in binary search tree stores these information:-

i) Model of the cars
ii) Colour Type
iii) Price
iv) Deposit
v) Pointer to left child
vi) Pointer to right child

A sample of data that can be used is as follows:-

Model Colour Type Price (RM) Deposit (RM)
Iswara 1.3 Solid 33,235.04 3300.00
Iswara 1.5 Metallic 34,299.67 3400.00
Wira 1.5 Metallic 51,966.00 5100.00
Wira 1.5 (A/B) Metallic 50,302.00 5000.00
Wira 1.6 (M) Metallic 59,036.00 5900.00
Wira 1.6 (A) Metallic 62,888.00 6200.00
Gen2 (M) Metallic 54,475.00 5400.00
Gen2 (A) Metallic 57,551.00 5700.00
Satria 1.3 (M) Solid 41,094.00 4100.00
Arena 1.5 Metallic 37,250.00 3700.00
Perdana V6 Metallic 98,961.00 9800.00

Develop a program that can read the data above from a file and store them in a form of binary search tree. The data must be sorted based on the model of the car. The program must be able to perform the following functions:-

i) InsertItem(ItemType) – To insert cars information into the tree based on model of car
ii) DeleteItem(ItemType) - To delete information from the tree based on model of car
iii) PrintTree() - To display all the information inside the tree
iv) RetrieveItem() - To search and display information based on model of car

Provide menu to select the operations above – (Add, Delete, Search and Display)
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 1,675
Reputation: vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold 
Solved Threads: 193
vmanes's Avatar
vmanes vmanes is offline Offline
Posting Virtuoso
 
0
  #2
Oct 18th, 2009
And your question is?
"We Americans got so tired of being thought of as dumb by the rest of the world that we went to the polls last November and removed all doubt."
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 4
Reputation: iris88 is an unknown quantity at this point 
Solved Threads: 0
iris88 iris88 is offline Offline
Newbie Poster
 
0
  #3
Oct 18th, 2009
Originally Posted by vmanes View Post
And your question is?
my lecturer say use C++ to write out this program o...that is my assignment question. sorry make troublesome
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 17
Reputation: cjjack88 is an unknown quantity at this point 
Solved Threads: 0
cjjack88 cjjack88 is offline Offline
Newbie Poster
 
0
  #4
Oct 19th, 2009
http://www.cplusplus.happycodings.co...hms/code5.html
Check this link...
Please do not post whole question to the forum and ask for help.
Reply With Quote Quick reply to this message  
Reply

Tags
6

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC