# Tag Info

## New answers tagged complexity

0

A way to start on figuring out if the complexity is O(1) or O(N) or a higher order is to figure out what happens if the value of n goes from n to n+1. If it's O(1) then the run time for the change from n to n+1 will be the same, if it's O(N) then the run time will change from n*k seconds to (n+1)*k seconds (for some constant k). if the change is something ...

-1

This is a basic mathematical function that translates one domain into another. The suggestions given by previous members are excellent. I would keep the integer as a key, as it requires less space. The hexadecimal approach given by Cristophe might be the best solution here, as it provides you with an easy way of getting the individual inputs back if needed. ...

4

Compile time solution 1 (clean) You could "concatenate" your input values using tuples, and map these tuples to your output type. Here how to do it with a string as output: string f (int a, int b, int c, int d) { using input = tuple<int,int,int,int>; static map<input,string> mytable = { { input{ 1, 3, 0, 1 }, "ok"}, ...

Top 50 recent answers are included