I have a height map (a 2D array of floating point values), and I want to find the highest point on the map, as soon as I find this point, I want to change its value and the values ββof all the nearest points. What is the best data structure used to efficiently find the highest point?
Requirements:
- Find the highest point effectively
- Change the value of an arbitrary set of points, this set will always contain the highest current point and the load of points nearby, the delta will be different for each point.
My current thinking is a priority queue, I can find the highest point in O (1), and I can change the load of values ββand heapify in O (n log n).
Nb. I marked this as an agnostic language and Lua, because it is rather an agnostic language issue, but I will implement the final solution in Lua.
source
share