Skip to content

LFUCache unexpected result #3781

@supertonyliu

Description

@supertonyliu

Description

https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/caches/LFUCache.java
function: private void addNodeWithUpdatedFrequency(Node node)
line 104
I think 104 code line:
node.previous = temp.previous;
need change:
temp.previous = node;

Steps to reproduce

No response

Excepted behavior

result ok!

Screenshots

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions