Are there any data structure that is similar to a map sorted by value? Like, a sorted data structure where I can update the value in logn
What do you mean by “update the value?” A map sorted by key allows updating the value associated with a key.
I want to update the value via the associated key. However, I also want the map sorted by value rather than key.
Well, you can store both
- a map from keys to values (either sorted or unsorted)
- a sorted set of values