| | |
My data structure assignment about binary search tree.i dunno how to do...
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2009
Posts: 4
Reputation:
Solved Threads: 0
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)
______________________________________________________
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)
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.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
•
•
Join Date: Oct 2008
Posts: 17
Reputation:
Solved Threads: 0
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.
Check this link...
Please do not post whole question to the forum and ask for help.
![]() |
Similar Threads
- Binary Search Tree (C++)
- Binary Search Tree within in BT ? (C++)
- Binary Search Tree (Java)
- Help with binary search tree insertion (C++)
- deleting a Binary search tree (C++)
- Binary Search Tree (C++)
- searching and inserting node in a binary search tree (C)
- recursive findaverage function for Binary search tree (C)
Other Threads in the C++ Forum
- Previous Thread: Using call functions....
- Next Thread: need help on this simple oop inheritance
| Thread Tools | Search this Thread |







