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

func RemoveByValue in doublylinkedlist.go may have one problem #14

Open
tmac33 opened this issue Aug 14, 2019 · 0 comments
Open

func RemoveByValue in doublylinkedlist.go may have one problem #14

tmac33 opened this issue Aug 14, 2019 · 0 comments

Comments

@tmac33
Copy link

tmac33 commented Aug 14, 2019

the block as below

current := list.head
	for current.next != nil {
		if current.next.data == i {
			if current.next.next != nil {
				current.next.next.prev = current
			}
			current.next = current.next.next
			return true
		}
		current = current.next
	}

there should no current.next.next==nil condition, if current.next.next==nil, then current.next will be the list.tail

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

1 participant