I want to Walk through the list until reaching the the next pointing to the node we want to get the previous node from.
This is what I have so far.. I think I'm on the right track, but right now, the output is funky. It's printing the index up to the "previous" node and then printing the data in those indices.
I know printing i is calling to print the index, how is the node printing too? And how to I get only the previous node to print rather than all previous nodes?
public SingleNode findPrev(int data) {
for (int i = 0; i < length(); i++) {
if ( i != data) {
System.out.println(i);
}
}
return null;
}
Output:
0 1 2 480-> 253-> <null> 253-> <null> <null>

New Topic/Question
Reply




MultiQuote



|