I need some help with coding. :(
It would be great if someone can help me with my problem.
I have vector of linked list.
eg)
Vector
---
A |
---
B |
---
C |
---
say if i want to insert linked list into list into C how would I
make listpointer point to C? than anohter one say in to A?
so it looks like
Vector
---
A | -> H
---
B |
---
C | -> G
---
i have struct of my node based on linked list and created vector of my struct
vector<Node> v;
here is what i did so far
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
void Vector::InsertEdge(char a, char b, int c){
Node *temp ;
temp = new Node;
temp -> node = a;
temp -> adjacent = b;
temp -> length = c;
//~ // insert new node to adjacency list
for (unsignedint i = 0; i <v.size(); i++) {
if (v[i].node == a) {
cout<<i<<endl;
//a code here to make my listpointer point to v[i]
temp -> next = listpointer;
listpointer = temp;
}
}