Languages like Python and Go embarrassingly don't have any kind of balanced tree data structures (e.g. AVL trees) in their standard libraries. You need these to implement the optimal solutions to many leetcode problems. I've always used Java or C++ in interviews for exactly this reason. However they're both significantly more verbose and I know Python and Go well so I feel like maybe this is hurting me more than I gain. Especially since I see Python recommended so frequently for interviews due to conciseness, I'm curious how people handle questions which need logarithmic data structures. Do you just mention this to the interviewer, then proceed to implement something less efficient with a hash map? Do you pull in a third party library? Switch language? Pray you don't get such a question?
C++ works fine for me
Apart from leetcode, you do not need to implement them in an actual interview. In a real interview you can assume that such a DS exists with a reasonable interface. For leetcode, get an implementation and keep it in your template library.
For most companies that's a safe assumption, but unfortunately not all of them...
Not a python coder but I thought the python dictionary was a balanced tree. Are you sure it's something else? Edit: from 3.7, they are.
Dictionary is a hash map.
from 3.7 dicts preserve insertion order, not key order (which may not even be defined)