Lets say we have a switch
function, e.g.
switch (obj) {
case 'Oranges':
const { a, b } = obj;
return a + b;
break;
case 'Apples':
const { c, d } = obj;
return c + d;
break;
case 'Bananas':
const { e, f } = obj;
return e + f;
break;
default:
return obj;
}
Question: what will be the time complexity of that function?
Question2: what if we raise the number of cases here to e.g. 100
? Will complexity raise aswell? If so - how many times?