Re:Data structures and algorithms I actually used while work...
by Cthulhu_ on Wednesday July 15, 2020 @04:26AM
(#23842616)
Java is an interesting one; while you don't write the sorting algorithm, you do write the sorting conditions, a function that returns a number depending on the compared values. Likewise there's hash functions, although in practice those will be generated by your IDE or Lombok. (I haven't been into Java for a while so there may be better alternatives, iirc Scala and / or Kotlin solve it as well)
[ Parent
| on HN ]
Re:Data structures and algorithms I actually used while work...
by ajuc on Wednesday July 15, 2020 @04:43AM
(#23842712)
Most of the time instead of writing or even using sort you're better off using a sorting collection like TreeSet or TreeMap.
No need to sort everything again after adding 1 element.