Find an element in a sequence: Difference between revisions

From Algowiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ Category:Checkup Category:Algorithmic Problem Category:Basic Problems on Sequences ==Input== # A sequence <math>S</math>. # an element <math>x</math> of...")
 
(No difference)

Latest revision as of 19:53, 1 October 2014

Input

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

Output

A boolean value:

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

Objective

N/A

Complexity

Linear

Known algorithms

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