When can an algorithm have square root(n) time complexity?

前端 未结 6 1049
攒了一身酷
攒了一身酷 2021-02-01 15:11

Can someone give me example of an algorithm that has square root(n) time complexity. What does square root time complexity even mean?

6条回答
  •  灰色年华
    2021-02-01 15:53

    JS Primality Test

    O(sqrt(n))

    A slightly more performant version, thanks to Samme Bae, for enlightening me with this.

提交回复
热议问题