Git Product home page Git Product logo

Comments (3)

garro95 avatar garro95 commented on June 15, 2024

Thank you for your bug report. The problem was in fact that the heapify operation should be only a down-heapify, but starting at the parent of the removed element.

Can I use your minimal reproducer as a test case? (It will be distributed as the library under both the LGPLv3 or later and MPLv2)

from priority-queue.

michalsrb avatar michalsrb commented on June 15, 2024

Of course, you can use it as a test case.

Are you sure that the down-heapify from the parent is enough? Consider heap like this:

           20
      7            19
    5   6      15     18
   1 2 3 4   13  14  16  17

As array: 20 7 19 5 6 15 18 1 2 3 4 13 14 16 17

If you remove the number 1, it gets replaced with 17 and that should filter up two levels. Filtering down from the parent won't do it. Unless there is something I am missing that prevents a heap like this in the first place?

from priority-queue.

garro95 avatar garro95 commented on June 15, 2024

You are right

from priority-queue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.