11
votes
Accepted
Optimized data structure mapping finite set of integers to values in C++
Design review
You are massively over-complicating the problem
You call it a map, and you talk about using integers as keys. But… in reality, because your keys are small, you are just using indices. So ...
4
votes
Accepted
A search function that searches for a contact inside a vector
Keeping in mind that it is impossible to give good answers, or a good review, without a clear context of what the code is for or how it is going to be used. A single member function—not even a full ...
4
votes
Accepted
Speed up searching for the lowest element that is not in the array
You present code for a typical "challenge" submission without ever spelling out the problem in the source code.
What's more, you miss the opportunity to declare a suggestively named business ...
4
votes
Optimized data structure mapping finite set of integers to values in C++
range check
There's no provision for validating key against N,
not even in a debug build.
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
performance × 9105python × 2344
java × 1280
c++ × 1077
algorithm × 1008
c# × 879
javascript × 837
programming-challenge × 646
python-3.x × 644
beginner × 623
c × 546
strings × 375
array × 326
php × 298
vba × 275
excel × 274
sql × 260
numpy × 241
primes × 218
jquery × 206
matrix × 182
image × 181
multithreading × 180
python-2.x × 179
recursion × 158