Thread: Linear - what and how

1. Linear - what and how

I am not an expert on maths or algorithms at all but I am a software developer.

What exactly is a Linear algorithm?
I was given a problem where we have 2 inputs and we need to produce a result set.

so we have 2 arrays. an input and index array.

the result must contain the product of the input array NOT including the current item index in the index array.

does this make sense?

so an input array could be 1 2 3 4 and the index array can be 2 0 4 3

so for the first index item, it is 2

this means that we should calculate 1, 2, and 4 from the input array.

thats all well but when they mention "linear" - what do they mean?

2. no one knows?

3. maybe you get then answer in this forum:

CodeGuru

4. no.... you have mis understood. i am not looking on how to develop code, I know how to do that, but what I mean is what does it mean when something says to do it in linear time?

what is linear time?

5. maybe it means starting from one point and go forth in one direction.

6. hmmm. ok so i flunked that test That sucks

so how would you do this in terms of logic?

you have 2 inputs.
you need to calculate the product of input 1. but you do not include the item in the first input which is the position referenced in input 2's array?

what kind of formula would that be?