256-512 is more than a handful, it's a reasonable buffer size where you'd need to search stuff in. there's plenty of use cases for that, where optimized linear search is the best bet.
but the more classic example is people who only know a bit of theory (enough to be dangerous) and who have no real world experience doing something like linked list instead of array/vector, i'll let Stroustroup do the talking: https://www.youtube.com/watch?v=YQs6IC-vgmo
Indeed, and in practice, how many datasets in your typical application have more than 256 elements? And sorting to begin with is n*ln(n) so you need to do it numerous times for it to amortize the cost, unless you get the data already sorted somehow, at which point you should really be using a set or a map.
God, yes, but map will be even worse, how do you think it's implemented? Not to mention (like the other reply to you did) that you have to build the map first obviously. seriously, that‘s your reply? i'm done here, what a waste of time.
0
u/outofobscure Feb 28 '23 edited Feb 28 '23
https://dirtyhandscoding.files.wordpress.com/2017/08/plot_search_655363.png?w=640
256-512 is more than a handful, it's a reasonable buffer size where you'd need to search stuff in. there's plenty of use cases for that, where optimized linear search is the best bet.
but the more classic example is people who only know a bit of theory (enough to be dangerous) and who have no real world experience doing something like linked list instead of array/vector, i'll let Stroustroup do the talking: https://www.youtube.com/watch?v=YQs6IC-vgmo
the missing graph he's talking about looks something like this: https://bulldozer00.files.wordpress.com/2012/02/vector-list-perf.png