PM 2Ring said:
Hi, Fee.
I assume you’ve already looked at sites like tutorialspoint and done a quick search on Stack exchange.
Sorry, I don’t do Java. But IIRC Dropbear does.
In the mean time, you might want to post a few more details about the problem you’re having.
Are you using the standard LinkedList class or is it your own custom class?
What happens when you try to add a new node to the head of the list?
Can you insert nodes successfully at other locations in the list?
It may not be a problem with the list, per se, but with how you’re referencing the node(s)… but as I said, I know next to nothing about Java.
Maybe post a small version of your program that illustrates the problem. This forum isn’t great at handling source code, but you can post code for free and anonymously at Pastebin (i.e., no registration is required) and post the link here. Pastebin has options for syntax highlighting, which makes it easier to read source code.
Hi PM
thanks for the reply. I have not tried those sites but will. I have been driving myself nuts trying to independently figure this out, I am pretty sure my logic is ok but my coding seems to be letting me down.
Its a custom class, the class definition, most of the methods and the test program have been supplied. I am required to write a method called add, which is called via another method called plus and adds expressions to a polynomial stored as a linked list. It’s the insertion at the front I am having trouble with. The insertion elsewhere seems to work ok with the data I am required to work with.
I have 8/10 of the polynomials created correctly but that was because all of them are presented in a way that I do not have to insert a node at the front. It appears that when I insert the node within the add method it is fine (using the debugger I can see everything is as it should be), but once it returns back to the calling plus method the inserted node and links disappear.
(If you wonder why I am putting myself through this I am doing a Computer Science degree :) )
I will try your suggestions :)