Hello everyone
My problem is the following:
I have a C program that takes a file including car models description where the models are described on a row of the file.
so far so good... but the last field reports the nameof a file including the list of accessories for that car model.
The program can add a car model, cancel one, add car optionals or delete them.
The search operations has to be performed with a cost at most logarithmic!
So i implemented it as a BST, with a structure for every node of my BST...
My questions are:
Having a last field of the file that gives me different elements, for every car model should I have a pointer that points to another smaller bst that contains all the informations about the optionals?
In this way, after loading my BST from the file I can insert everytime a new car model and new optionals for existing cars...Code:typedef struct model { char *carmodel; char data[25]; int prices; struct model *left; struct model *right; struct optionals *optional; } model_t; typedef struct optional{ char *nameaccessory; char date[25]; int prices; struct optional*left; struct optional*right; } acc_t;
Is it right?
I was thinking of using a list for the optionals elements but I'm not sure how to do it...
Thanks for your help![]()



LinkBack URL
About LinkBacks



