Time complexity of Memset in C++

Revision en2, by Suleyman.A, 2020-05-20 14:56:15

Hi, I want to know the time complexity of this code

include <bits/stdc++.h>

define N 100010

using namespace std;

int T[N*4];

int main() { memset(T, 0x3f3f3f3f, sizeof(T)); }

Many people say that memset's time complexity is O(logN), but my opinion is O(N).

Is O(logN) right? If not, is there any way to do that operation in O(logN)?

Please write your opinions.


  Rev. Lang. By When Δ Comment
en3 English Suleyman.A 2020-05-20 14:57:26 16
en2 English Suleyman.A 2020-05-20 14:56:15 4
en1 English Suleyman.A 2020-05-20 14:55:23 424 Initial revision (published)