ods icon indicating copy to clipboard operation
ods copied to clipboard

SLList wrong function addAfter

Open changliu98 opened this issue 6 years ago • 1 comments

Line 120

protected void addAfter(Node u, Node v) {
		v = u.next.next;
		u.next = v;
		if (u == tail) 
			tail = v;
}

the v=u.next.next; seems wrong, this function will only delete the node after u

changliu98 avatar Nov 11 '19 19:11 changliu98

The solution is to make v = u.next.next; --> v.next = u.next;

tmcdonnell2 avatar Apr 28 '21 03:04 tmcdonnell2