I am working on a program where I sort elements into alphabetical order and then when one is less than the other I swap them. I first did it by swapping the data but they want me to swap the nodes instead and I am having trouble doing that. Any help would be appreciated.
Why you don't use something like set<Node> or list<Node>?
In set<Node> sorting is done automatically when inserting node.
In list<Node> you can use upper_bound(...) for find place for insertion.
In any case it wuold be quicker (O(ln(n))) than your algorithm (O(n)) and insertion would be done by changing pointers, not moving whole struct.