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

DoublyLinkedList.Insert() forgets dealing with element.prev #43

Closed
masknu opened this issue Jan 7, 2017 · 1 comment
Closed

DoublyLinkedList.Insert() forgets dealing with element.prev #43

masknu opened this issue Jan 7, 2017 · 1 comment
Labels

Comments

@masknu
Copy link

masknu commented Jan 7, 2017

In order to construct a "doubly" linked list while inserting, new element and old element's prev pointer have to get updated.
Solution:
In doublylinkedlist.go,

  • Line 262, add:
  • newElement.prev = beforeElement
    
  • Line 266, add:
  • oldNextElement.prev = beforeElement
    
  • Line 271, add:
  • newElement.prev = beforeElement
    
  • Line 274, add:
  • oldNextElement.prev = beforeElement
    
@emirpasic emirpasic added the bug label Mar 5, 2017
@emirpasic
Copy link
Owner

@masknu Thanks, good catch! It's been fixed now in #52

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

No branches or pull requests

2 participants