Given this pseudocode that extracts a sample sequence from the data sequence of length N:
Function Sampler (Sequence Data)
Set Sample to an empty sequence
Set N to the length of Data
While N>=1
Append element N of Data to Sample
N:= N/2
Return Sample
What is the worst-case run time for Function Sampler?
I already know the answer is A, but I would like the reasoning behind the answer. Thank you.
A) O(log N)
B)O( N/2)
C) O( N)
D) O( N log2 N)