Thanks to visit codestin.com
Credit goes to github.com

Skip to content

wrong returned value in hash-table-linear-probing #208

Closed
@Yamiqu

Description

@Yamiqu

https://github.com/loiane/javascript-datastructures-algorithms/blob/main/src/ts/data-structures/hash-table-linear-probing.ts#L45-L61

In the implementation of the get function, the returned value is not the correct index found by the while loop, instead of the original index.
As a result, the first result will be returned instead of the expected one.

As follows

const test = new HashTableLinearProbing();

test.put('Jonathan', '5Jonathan');
test.put('Jamie','5Jamie')
test.put('Jack','7Jack');
test.put('Athelstan', '7Athelstan')

test.get('Jamie')  // =>  5Jonathan
test.get('Athelstan')  // => 7Jack

So I submitted a PR about fixing this problem. #207

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