Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLList wrong function addAfter #81

Open
changliu98 opened this issue Nov 11, 2019 · 1 comment
Open

SLList wrong function addAfter #81

changliu98 opened this issue Nov 11, 2019 · 1 comment

Comments

@changliu98
Copy link

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 changliu98 changed the title SLList.java SLList wrong function addAfter Nov 11, 2019
@tmcdonnell2
Copy link

tmcdonnell2 commented Apr 28, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants