Skip to main content
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 ...
indi's user avatar
  • 12k
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 ...
indi's user avatar
  • 12k
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 ...
greybeard's user avatar
  • 6,519
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. ...
J_H's user avatar
  • 30.8k

Only top scored, non community-wiki answers of a minimum length are eligible