View Single Post
Nov8-09, 02:15 AM
P: 986
You need to post more code, including initialization and declarations. I suspect that there's something going wrong during the very first insertion, where the node with 23 ends up pointing at itself (lines 14-17 of your fragment).

     Node traverseInOrder = first; // loops through the linked list (first is preconstructed node)
     iterator.successor = traverseInOrder;
     first = iterator;
Unfortunately, I know C++ much better than I know Java. In C++, it would've been much clearer (to me, anyways) whether objects being assigned are pointers, references, or values.