c++ - how to compare two elements in priority_queue -


i defined priority_queue<pair<double, int>>. smaller double value has higher priority. if there several same double values in queue, pop 1 randomly. example: (<0.1, 1>, <0.1,2>, <0.1, 0>,<0.1,5>), how pop 1 of them randomly? not sure if idea reasonable. because location of element has been determined ,when pushed queue.

you store tuples double, int, int, last term unique random number comparator use resolve comparisons of equivalent elements.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -