recategorized by
230 views
1 votes
1 votes

Let us suppose we are given an integer $\text{N}$ in binary representation. Let us consider the following algorithm to check if $\text{N}$ is a prime.

  • For every $i$ such that $2 \leq i \leq\lceil\sqrt{\text{N}}\rceil$, check if $i$ divides $\text{N}$.
  • If any of the $i\text{'s}$ divides $\text{N},$ return that $\text{N}$ is not a prime.
  • Else, return that $i$ is a prime.

Based on this information, answer the following.

What is the order of magnitude of the running time in terms of the input size? (Assume hypothetically that division can be done in $\text{O}(1)$ time).

recategorized by

Please log in or register to answer this question.

Related questions

1 votes
1 votes
0 answers
2
admin asked Dec 15, 2022
270 views
If the prefix traversal order of a tree is $*+\mathbf{a} \mathbf{b}-\mathbf{c} \mathbf{d}$. Then, find the equivalent postfix order of the that tree.
1 votes
1 votes
0 answers
3
admin asked Dec 15, 2022
235 views
Total number of functions from set $B$ to set $A$ with $n$ and $m$ elements, respectively are ___________.
1 votes
1 votes
1 answer
4
admin asked Dec 15, 2022
304 views
For decimal number $-30$, the $16$-bit $2$'s complement representation is _________