943,935 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1516
  • C++ RSS
Oct 17th, 2009
-2

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

Expand Post »
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)
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
iris88 is offline Offline
4 posts
since Oct 2009
Oct 18th, 2009
0
Re: My data structure assignment about binary search tree.i dunno how to do...
And your question is?
Reputation Points: 1268
Solved Threads: 228
Posting Virtuoso
vmanes is offline Offline
1,895 posts
since Aug 2007
Oct 18th, 2009
0
Re: My data structure assignment about binary search tree.i dunno how to do...
Click to Expand / Collapse  Quote originally posted by vmanes ...
And your question is?
my lecturer say use C++ to write out this program o...that is my assignment question. sorry make troublesome
Reputation Points: 10
Solved Threads: 0
Newbie Poster
iris88 is offline Offline
4 posts
since Oct 2009
Oct 19th, 2009
0
Re: My data structure assignment about binary search tree.i dunno how to do...
http://www.cplusplus.happycodings.co...hms/code5.html
Check this link...
Please do not post whole question to the forum and ask for help.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cjjack88 is offline Offline
17 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Using call functions....
Next Thread in C++ Forum Timeline: How do you add the same members of a do while loop?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC