为什么朴素素性测试算法不是多项式

M .*_*lin 4 algorithm time-complexity

我想了解为什么以下朴素素性测试算法不是多项式。

IsPrime (n: an integer)
Begin
   For i=2 to n-1 do
     If (n % i == 0) then
        return (no)
     EndIf
   EndFor

   return (yes)
End
Run Code Online (Sandbox Code Playgroud)

该算法被认为是输入n大小的指数。为什么这是真的?为什么下面的排序测试算法说是多项式而不是指数?

IsSorted (T[n]: an array of n integer)
Begin
  For i = 1 to n-1 do
     If (T[i] > T[i+1]) then
        return (no)
     EndIf
  EndFor

  return (yes)
End
Run Code Online (Sandbox Code Playgroud)