next up previous
Next: Algorithm Up: DESIGN AND ANALYSIS Previous: DESIGN AND ANALYSIS

EXAMPLE PROBLEM: Sequential Search

Problem:
Given an array $L[1..n]$, containing $n$ DISTINCT entries, find the index of $x$, if $x \in L$, else return 0.
Input:
array $L$, array size $n$, search item $x$.
Output:
If $x \in L$ then index of $x$ in $L$, else 0.
Algorithm:
.
Abstract Level Description: Scan $L$ left to right looking for $x$ in $L$ & return index.



Subsections

Sushil_Prasad 2012-08-23