如何更新优先级队列中的位置
how to update locations in priority queue
这是我的场景,我想要一些智能的解决方案来解决这个问题。
我有1024个位置,每个位置都与一个条目相关联。现在,我在已经存在的1024个位置的基础上添加了1024个位置。现在,我必须更新与旧1024个位置相关联的现有条目的位置。有没有什么聪明的方法可以在不遍历所有1024个条目的情况下做到这一点。
下面是场景。
location 0 associated to ==> entry 0
location 1 associated to ==> entry 1
location 2 associated to ==> entry 2
location 3 associated to ==> entry 3
.
.
.
.
location 1023 associated to ==> entry 1023
now i have added new 1024 locations on top. so i have to update the locations of entries as follow
location 0 new location
location 1 new location
location 2 new location
location 3 new location
location 4 new location
.
.
.
.
location 1024 associated to ==> entry 0
location 1025 associated to ==> entry 1
location 1026 associated to ==> entry 2
location 1027 associated to ==> entry 3
location 1028 associated to ==> entry 4
.
.
.
location 2047 associated to ==> entry 1023
要做到这一点,有没有任何方法可以做到这一步,而不需要一个接一个地循环所有条目并更新位置?
相关文章:
- boost::进程间消息队列引发错误
- 将值指定给向量(2D)的向量中的某个位置
- 如果我只是不访问queue_front节点的子节点,而是将它们推到队列中呢?还是BFS吗
- 使用Unreal C++获取VR耳机的世界位置/方向
- 写入位置0x0000000C时发生访问冲突
- Android NDK传感器向事件队列报告奇怪的间隔
- C++优先级队列,按对象的唯一指针的特定方法升序排列
- 如何将两个不同矢量的同一位置的两个元素组合在一起
- 按对象的特定方法按升序排列的C++优先级队列
- 使用2个键的cpp-stl::优先级队列排序不正确
- GL_SHADERSTORAGE_BUFFER位置是否与其他着色器位置冲突
- 如何使用cudaMallocManaged在指针位置初始化对象?(C++)
- 无法获取webot::PositionSensor对象中位置传感器的值
- 我是否需要在下一次转移时将所有权*转移回转移队列
- 非常量变量只读位置的赋值
- 可以将Boost消息队列文件重定向到用户指定的位置
- 在队列中选择备用位置
- 8谜题代码.我的队列没有填充,我找不到错误的位置
- 在磁盘C 上的特定位置中创建队列
- 如何更新优先级队列中的位置