Re:Everything I wish I knew when learning C
by wnoise on Monday November 28, 2022 @05:35PM
(#33780867)
And any structure is O(1), not O(n), because C structures are not parameterized.
[ Parent
| on HN ]
Re:Everything I wish I knew when learning C
by jcelerier on Monday November 28, 2022 @05:40PM
(#33780918)
memcpy is not O(1)
Re:Everything I wish I knew when learning C
by LegionMammal978 on Monday November 28, 2022 @06:03PM
(#33781144)
It's O(1) relative to any size computed at runtime: that is, running the same program (with the same array size) on different inputs will always take the same of work for a given assignment.
Re:Everything I wish I knew when learning C
by jcelerier on Monday November 28, 2022 @09:55PM
(#33783131)
We're in the context of the assignment operation in the language here. Yes, in C you can only assign statically-known types but that does not mean you can just ignore that a = f(); may take a very different time depending on the types of a and f