You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the node that tail points to contains a value equal to key, the pointing of tail does not change, which results in that node actually not being deleted.
Hi @Fr1eran, thanks for pointing this out, due to heavy work these couple of days i will look at this shortly(most probable tomorrow). No need to mention something else!
I have found three bugs in the
doubly_linked_list
class, below I will show how to reproduce them and give possible solutions.Bug in
search
methodDue to
t != tail
condition statement, the value stored intail
node can never be searched.How to reproduce
test code like:
expected output:
1
actual output:
0
Possible solution
Bug in
push_front
methodDue to the lack of
tail = p
,root
andtail
will not point to the same node whenpush_front
is called on an empty chain.How to reproduce
test code like:
expected output:
{1 2 3 }
actual output:
{1 }
Possible solution
Bug in
erase
methodWhen the node that
tail
points to contains a value equal tokey
, the pointing of tail does not change, which results in that node actually not being deleted.How to reproduce
test code like:
expected output:
{1 2 4 5}
actual output:
{1 2 }
Possible solution
I refactored this function and provided a version that can delete all matching elements.
If there's a more elegant way to write it then that would be great. :)
The text was updated successfully, but these errors were encountered: