I am creating a graph with the help of adjacency matrix, how can I store the values in the matrix? do I need to change the size of the body with each insertion of the node?
>Solution :
If the number of nodes are not fixed then use an adjacency list instead of a matrix. if you want to use the adjacency matrix firstly scan all the inputs and find the distinct N nodes, after that you can create NxN matrix to store the results. in this way you need to scan the list twice firstly to get the distinct nodes and then the vslues.