does anyone know the current running time for this c-string function: memchr()? is it constant/O(1), or O(size of string) ?
does anyone know the current running time for this c-string function: memchr()? is it constant/O(1), or O(size of string) ?
some entropy with that sink? entropysink.com
there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka
I don't really get what do you mean by "current running time", but the function
returns a pointer to the first occurence of ch in the first count characters of the given buffer.Code:void* memchr( const void *buf, int ch, size_t count );
If none found, it returns a NULL pointer.
Hope I answered your question.
Hint: www.cppreference.com/stdstring_details.html#memchr
[R]evolution!
Programming related articles, downloads, demos
It runs in linear time (O(n)) if that's what you want.
I'm not sure how you expect a search function on unsorted linear memory to be any faster.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
not expecting but hoping thanksOriginally posted by CornedBee
It runs in linear time (O(n)) if that's what you want.
I'm not sure how you expect a search function on unsorted linear memory to be any faster.
some entropy with that sink? entropysink.com
there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka
Hoping against all logic?
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
>> Hoping against all logic?
that is what miracles are, aren't they? LOL....I thought that is was linear...but couldn't find any documentation to prove it....
some entropy with that sink? entropysink.com
there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka