Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
There isn't a "sentinel search" or "sentinel linear search" algorithm per se. That's mostly a poor translation courtesy of the bloat of unauthoritative plagiarized garbage floating around the internet.
A "sentinel node" is a value in a series or tree intentionally inserted at the end of the iterable series so that the result of the search will always return a value.
The word sentinel means a guard. The function of the sentinel value is to guard against null matches.
A linear search with a sentinel node will terminate with the query value. That value will then be returned at index n+1 if no other matches
are found:
find: "10"
source series: 1,2,3
n+1 series: 1,2,3,10
f(x,l) -> [...l,x].find(x); -
@SortOfTested And the point of that is to safely omit range checks, which makes shit going faster.
-
Okay,
I will admit, i dont know what the talk is about, or i wont pretend i know shit about algorithms, but this sounds like null termination on string thing? -
@DubbaThony That's a termination character, not a sentinel. The sentinel value is always the one you're looking for.
-
@Fast-Nop
Okay, if you remove abstraction wtf that means?
Edit: i mean like usage or something..
Like example
Edit2:
Okay, i googled it, and apparently yes, null termination character is sentiel value. But thats not algorithm or anything like that, just concept. -
@DubbaThony It's not a sentinel. The big difference is that with a sentinel, you ONLY check for the value you're looking for when going through the data. With null termination, you look for a certain character or pattern and STILL have to do the null check.
-
@Fast-Nop
Okay, well, makes sense.
Google aint allways right and im too tired to filter that all. Just got curious, never heared of that thing and it sounded intriguing
Hello I am beginner in coding I have a doubt about sentinel search means can anyone give me a small example so that I can understand it properly
question