r/computerscience • u/Obi_Wan_06 • Sep 24 '25
does sequential search compare every element even if there is an absence?
like for example we have this list (1,5,17,40,92,100) and i want to see how many comparisons will it do to understand that the number 35 for example is missing. will it stop at 40 or will it go till the end of the list?
1
Upvotes
View all comments
Show parent comment
1
u/Almoturg Sep 24 '25
The data might be sorted because of how it's generated (e.g. log entries, assuming the clock is monotonic).