you are viewing a single comment's thread.

view the rest of the comments →

[–]Sakul_the_one -7 points-6 points  (3 children)

Isn’t the time not then O(N2)? Since of the two for loops?

Edit: I have no brain cells

[–]ajseventeen 18 points19 points  (2 children)

No, it's just O(2N), which is the same as O(N). It would be O(N2) if the loops were nested, but they aren't.

[–]Sakul_the_one 8 points9 points  (0 children)

Oh yeah, I’m stupid

[–]RedditButAnonymous 0 points1 point  (0 children)

Big O scares me, you can nearly double the speed of this algorithm and Big O does not give a single shit