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

Closed
opened 2017-01-07 18:41:02 +00:00 by masknu · 1 comment
masknu commented 2017-01-07 18:41:02 +00:00 (Migrated from github.com)

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
    
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 commented 2017-03-05 22:35:32 +00:00 (Migrated from github.com)

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

@masknu Thanks, good catch! It's been fixed now in #52
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
golibs/gms-gods#43
No description provided.