>You might need to wrap all the nodes in a dummy struct that contains the node and that flag member.
U r essentially talking about nesting the node structure with a suitable wrapper structure that defines the "flag" parameter right?
Yeah, this gives a better time complexity too just O(n)..