hi guys
i have this problem with the linked list algorithm,it seems every time a new link object is added it overwrites the preceding one(at least it seems so in java which the code for the algorithm is in though i want to implement it in c++)
this is the code i have a problem with,specifical ly.Thanks
p.s pls dont tell me how java handles objs.My problem is with this part of the algorithm itself(regardle ss of language).
i have this problem with the linked list algorithm,it seems every time a new link object is added it overwrites the preceding one(at least it seems so in java which the code for the algorithm is in though i want to implement it in c++)
Code:
public void insertFirst(int id, double dd) { // make new link Link newLink = new Link(id, dd); newLink.next = first; // newLink --> old first first = newLink; // first --> newLink }
p.s pls dont tell me how java handles objs.My problem is with this part of the algorithm itself(regardle ss of language).
Comment