I want to create a linked list of musical genres where each node is one genre of music (i.e. reggae, classical, rock, etc.). Within each node, I want to have another list of artists that fall under that specific genre.
My question is how do I get the list of artists into the nodes of the list of genres?
In my code, I have a class called Artist where I will manage the information (such as the artist's name, album names, number of albums, etc.) of one artist. Next, I created a node struct that will be used for the implementation of a linear linked list of artists. I created a class called Artist_List to manage the linked list of artists.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
class Artist
{
private:
char * name;
char * albums[size];
int num_of_albums;
public:
//functions to manage the creation of an artist
};
struct node
{
Artist one_artist;
node * next;
};
class Artist_list
{
private:
node * head;
public:
//functions to manage the linear linked list
};
| |
I am confused on where to go from here. I can create a list of Genres the same way I do the list of Artists. However, how would I get the list of Artists into the nodes of the Genre list. Would the node struct for Genre contain another pointer, one that points to the list of Artists?
Any suggestions?
I don't need coding examples if it's too tedious to write (general examples, maybe), but an explanation or ideas of how I could solve this problem would greatly help!