Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7762661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:27:53+00:00 2026-06-01T14:27:53+00:00

Lets say I am writing Dijkstra’s Algorithm , and I have a priority queue

  • 0

Lets say I am writing Dijkstra’s Algorithm, and I have a priority queue that is keeping the shortest distance node on the top. However as I traverse the graph I will be updating the distance to that vertex. I have placed references to all vertices in the priority queue that are contained in the data structure. Now as I update the vertices in the data structure, I would like for the data in the priority queue to adapt to those changes, so the nearest node is always on top. However, after stepping through my application with the debugger, I have noticed that the priority queue does not update itself. How do I get it to do this, without re-inserting all vertices back into it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:27:55+00:00Added an answer on June 1, 2026 at 2:27 pm

    STL priority_queue assumes that you only use the push() and pop() methods to modify the data structure. It does not track changes to the data structure.

    After modifying the interior of the priority_queue’s underlying container you need to call make_heap() on the container to restore the heap property. STL priority_queue does not provide iterators on the underlying container. Instead you need to manually manage a deque or a vector as a priority queue and call make_heap(), push_heap(), and pop_heap() as needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say that I am writing a program that supports plugins and I write
Lets say I have the below method called DoSomething. When writing unit tests how
I'm writing a windows service that should perform an action every, lets say, 60
Lets say we have a native library that works with data like this: double
I am having trouble writing a query. Lets say I have a table full
Lets say that i have a class with some instance variables and i want
Lets say I have a table with three columns, key , value and priority
So, lets say I'm writing a web server and I want to support very
Let's say I'm writing a PHP (>= 5.0) class that's meant to be a
That is to say, let's say I'm writing something that's hosted on foo.com .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.