World's most popular travel blog for travel bloggers.

# Running time of an algorithm containing binary elements for cryptography

, ,
Problem Detail:

Hey guys sorry I'm new to cs and I'm trying to find the running time of algorithms... could you tell me about the algo given how much time is needed in terms of complexity? The actual algo I created is the same as below but the sum must be more or equal to 2^(n-2).Thank you]1

###### Answered By : p77u4n M.S.O LAB HUST

We take only one step for computing each $2^ix_i$ (By using left-shift operation we can compute $2^i$ in constant time). So the complexity of Algorithm $\mathcal{A}$ is $\mathcal{O}(n)$.

I suspect you used loop for computing $2^i$, and this incurred your bad result.

PS : sorry for my bad english