Timeline for Sentinel linear search
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 31, 2020 at 21:25 | answer | added | CertainPerformance | timeline score: 1 | |
Aug 31, 2020 at 21:20 | comment | added | mikebrsv |
@Mast basically, we put the value we're searching for into the last position of the array to avoid 2 checks on every iteration of the loop (in for loop it's evaluation of the condition expression and execution of the statement, both of which are called on each iteration). After the value is found, we restore the original value of the last position in the array and perform one additional check on the array
|
|
Aug 31, 2020 at 21:04 | comment | added | mikebrsv | @Mast no, it's from the book Algorithms Unlocked by Thomas Cormen | |
Aug 31, 2020 at 20:58 | comment | added | mikebrsv | @Mast Linear search with a sentinel, en.wikipedia.org/wiki/Linear_search#With_a_sentinel | |
Aug 31, 2020 at 20:56 | comment | added | Mast♦ | Is it related to this programming challenge? | |
Aug 31, 2020 at 20:56 | comment | added | Mast♦ | For those of us that don't know, can you tell us what makes a 'sentinel linear search' special with regards to an ordinary 'linear search'? | |
Aug 31, 2020 at 20:53 | history | edited | Mast♦ | CC BY-SA 4.0 |
This is Code Review, not Code Alternatives. Reworded question, welcome!
|
Aug 31, 2020 at 20:42 | review | First posts | |||
Aug 31, 2020 at 20:54 | |||||
Aug 31, 2020 at 20:41 | history | asked | mikebrsv | CC BY-SA 4.0 |