Results 1 to 1 of 1
- 03-13-2011, 01:19 PM #1
Member
- Join Date
- Nov 2009
- Location
- Honolulu, HI
- Posts
- 50
- Rep Power
- 0
Guidance Needed for Removing a Node
I'm stuck with this problem I've been working on for the past few days. The only portion of the program I'm having trouble with is the method which removes nodes from a list. My initial thinking was if the node was to be removed, then I could set the next node to the current node's position; however, when I do this, I get caught in a never ending loop. Any guidance is greatly appreciated.
Code below:
Java Code:private static Node removeNodes(Node h, int iVal) { while (h != null) { // check if first node is empty int temp = h.data; if (temp != iVal) { // test to see if temp is equivalent to iVal h = h.next; // move to next node } else { h.next = h; // set next node to current node, deleting old node h = h.next; // move to next node } } return (h); }
Similar Threads
-
Some Guidance
By bengregg in forum Java AppletsReplies: 15Last Post: 01-11-2011, 10:04 AM -
newbie guidance.
By Bgreen7887 in forum New To JavaReplies: 28Last Post: 10-17-2010, 10:31 PM -
Guidance for SCJP
By sairam in forum New To JavaReplies: 1Last Post: 06-30-2010, 09:21 AM -
Guidance needed
By Curtiz in forum AWT / SwingReplies: 1Last Post: 03-23-2010, 05:41 PM -
Guidance
By gizdev in forum New To JavaReplies: 5Last Post: 09-07-2008, 07:14 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks