Simple Adjacency List

Guys!I am trying to do this!
X | A->C
Y | A->B->C
Z | B->C
I want a pointer on left(X,Y,Z) to point to first linked list then increment and move down(Y) and then point to the second linked list! Should I create another struct abc type array? Things are mixing up in my mind!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
using namespace std;
struct abc
{
	abc *next;
	char data;
}; abc *Head = NULL;
void insert()
{
		abc *node = new abc;
		cout << "Enter the data you want to enter " << endl;
		cin >> node->data;
		node->next = NULL;
		if (Head == NULL)
		{
			Head = node;
		}
		else
		{
			abc *temp = Head;
			while (temp->next != NULL)
			{
				temp = temp->next;
			}
			temp->next = node;
		}

	}
int main()
{
	char z='A';
	int x;
	cout << "Enter number of rows of linked list " << endl;
	cin >> x;
	abc *start = new abc[x]; // should i make start pointer?
	for(int i=0;i<x;i++)
	{
		start[i] =
		for (int j = 0; j < x; j++)
		{
			insert();
		}
		
	}
	

}
Should I create another struct abc type array?
Yes, or use another linked list; any sequential container will do.
Topic archived. No new replies allowed.