Skip to content

Insertion near the end doesn't work #97

@DancingPhoenix88

Description

@DancingPhoenix88

Describe the bug
Insertion in the 2nd half causing length reduced, but it supposed to be increased.

To Reproduce

  1. Turn this list into a DoublyLinkedList:
[
[0] 	= (1, 2), 
[1] 	= (1, 1), 
[2] 	= (2, 1), 
[3] 	= (3, 1), 
[4] 	= (4, 1), 
[5] 	= (5, 1), 
[6] 	= (6, 1), 
[7] 	= (7, 1), 
[8] 	= (7, 2), 
[9] 	= (7, 3), 
[10] 	= (7, 4), 
[11] 	= (7, 5), 
[12] 	= (6, 6), 
[13] 	= (5, 6), 
[14] 	= (4, 6), 
[15] 	= (3, 6), 
[16] 	= (2, 6), 
[17] 	= (1, 6), 
[18] 	= (0, 6), 
[19] 	= (0, 5), 
[20] 	= (0, 4), 
[21] 	= (0, 3), 
[22] 	= (0, 2)]
  1. Insert (6, 5) at index 12 (between (7, 5) and (6, 6)
  2. Result is: The list reduced from 23 elements to 22 elements, and (6, 5) & (6, 6) are missing in the list

Expected behavior
The list should have 24 elements with this exact content

[
[0]	= (1, 2), 
[1]	= (1, 1), 
[2]	= (2, 1), 
[3]	= (3, 1), 
[4]	= (4, 1), 
[5]	= (5, 1), 
[6]	= (6, 1), 
[7]	= (7, 1), 
[8]	= (7, 2), 
[9]	= (7, 3), 
[10] 	= (7, 4), 
[11] 	= (7, 5), 
[12] 	= (6, 5),
[13] 	= (6, 6), 
[14] 	= (5, 6), 
[15] 	= (4, 6), 
[16] 	= (3, 6), 
[17] 	= (2, 6), 
[18] 	= (1, 6), 
[19] 	= (0, 6), 
[20] 	= (0, 5), 
[21] 	= (0, 4), 
[22] 	= (0, 3), 
[23] 	= (0, 2)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions