Skip to content

Insert() bug #1

Description

@mateofio

Unless I'm overlooking something there appears to be a bug in your HashTable::Insert() method.

First you search for the Cell with matching key or an empty cell with key == 0.
Then if key == 0 you do a resize check before doing the insertion.

The problem is once you resize the array, the cell pointer you had before now points to garbage. After resizing you need to redo the lookup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions