| | | | | |

Sequential Search Algorithm

  • Assumptions:
    • collection L of data of type T
    • can iterate through L ("begin", "next", "end")
  • Outcomes:
    • decide whether t is in L
    • return boolean (yes/no)
  • Proof: (postponed)
  • Body (written in pseudocode):
  • T item = begin(L);
    while (item is in L)
    {
      if (t == item)
        return true;
      item = next(L);
    }
    return false;
    

| | Top of Page | 3. Introduction to Algorithm Analysis - 4 of 23