3 ms·
The article actually does both (uses bsearch, and also the home made one) presumably just to demonstrate both.
by smcameron 6y ago
The article actually does both (uses bsearch, and also the home made one) presumably just to demonstrate both.
- smcameron 6y ago(I noticed this because I was wondering why the cmp() function was taking void pointers only to cast them to "item*", and it occurred to me it would make sense if it were passed as a function pointer to a generic library function with no knowledge of "item*"... as it is when bsearch is used.)
- e12e 6y agoHeh, I missed that - just skimming the code on mobile. Maybe there should be a slight edit in the text and/or the custom binary search could be dropped (as it's not the main focus of the article).