my scenario is this
and in build function i make the list as below(here 1,2,3,4 are nodes and -> shows its adjacency list)Code:class Graph { private: struct ListNode { long long int name; struct ListNode *next; //This creates the same ListNode structure for the next and down pointers each one will have a name, a next, and a down. struct ListNode *down; }; ListNode *head; ListNode *down_head; public: Graph() //Constructor { head = NULL; //in-line initializations of head and down_head down_head = NULL; } void build() ; };
1->2->4
2_>3
3->NULL
4->NULL
it works fine in all cases
but in main function i call the build for some iterations say
now each time i want my adj lists and nodes to be reset...but the old values of prev iteration also exists...Code:while(t) { s.build(); t--; }
In the new iteration i construct entirely new nodes and new adj lists... but old values existing... any help
thanks



LinkBack URL
About LinkBacks


