C++ Basic Data Structures - Getting Started / Basic Data Structures



map[key] gets item mapped to key if present, and inserts the key if not, O(N)

thos should be O(1) amortized.
checking existence is O(1)
insertring os O(1)
O(1) + O(1) = O(1)

ignoring collisions of course,

Mainly just asking opinions as it probably just depends on what language you are most comfortable with but…any reason(s) why you would not want to use C++ in your first coding interview? Like, instead of Python? I know you can code programs/exercises quicker in Python but any other reasons? I like both of those languages so much so figured I’d ask.

Agree. For worst case, all should be O(N).
However, if we ignore collision in most cases, get/set element should be O(1).