Machine-translated by Google. Questions are authored in English.
Top

Discussion

The extra key inserted at the end of the array is called a/an :

  • A.End key
  • B.Stop key
  • C.Sentinel
  • D.Transposition

Answer: C

The extra key is called a sentinel.

In a sentinel search the value being looked for is placed in an extra position at the end of the array before a linear search starts. The loop can then compare elements with the key without also checking at every step whether the index has passed the end, because the search is certain to stop at the sentinel. If it stops there, the key was not in the original array.

'End key' and 'stop key' are not the standard terms, and transposition is a self-organising search heuristic that swaps a found item with its predecessor.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.