Find an element in a sequence

From Algowiki
Jump to: navigation, search

Input

  1. A sequence [math]S[/math].
  2. an element [math]x[/math] of the component type of [math]S[/math].

Output

A boolean value:

  1. [math]true[/math], if [math]x[/math] is currently in [math]S[/math],
  2. [math]false[/math], otherwise.

Objective

N/A

Complexity

Linear

Known algorithms

  1. Find element in sequence iteratively
  2. Find element in sequence recursively