I have stumbled upon two examples of recursively defined functions:
1. This recurrence arises for a recursive functions that halves the input, but perhaps must examine every item in the input -> CN=C(N/2)+N
That makes sense to me - every time we have we do something to all the elements in the current set hence +N. This converges to N/2+N/4+N/8+...=2N. All clear.
But next author defines another recursive function: This recurrence arises for a function that has to make a linear pass through the input before, during or after splitting that input into two halves -> CN=2CN/2+N. The problem is why we multiply it by 2? We basically do a linear pass thru elements so it should be same as in the previous case #1, namely just add N.
So what do I miss here?
1. This recurrence arises for a recursive functions that halves the input, but perhaps must examine every item in the input -> CN=C(N/2)+N
That makes sense to me - every time we have we do something to all the elements in the current set hence +N. This converges to N/2+N/4+N/8+...=2N. All clear.
But next author defines another recursive function: This recurrence arises for a function that has to make a linear pass through the input before, during or after splitting that input into two halves -> CN=2CN/2+N. The problem is why we multiply it by 2? We basically do a linear pass thru elements so it should be same as in the previous case #1, namely just add N.
So what do I miss here?