{
  "translations" :{
    "en": {
      "sc1": "For some algorithms, different inputs of a given size require different amounts of time. For example, consider the problem of searching an array containing $n$ integers to find the one with a particular value $K$ (assume that $K$ appears exactly once in the array).",
      "sc2": "The algorithm accepts as its input an array of $n$ keys and the target key $K$ to search for.",
      "sc3": "The sequential search algorithm begins at the first position in the array and looks at each value in turn until $K$ is found. Once $K$ is found, the algorithm stops. This is different from the largest-value sequential search algorithm, which always examines every array value.",
      "sc4": "There is a wide range of possible running times for the sequential search algorithm. The first integer in the array could have value $K$, and so only one integer is examined.",
      "sc5": "In this case the running time is short. This is the <b>best case</b> for this algorithm, because it is not possible for sequential search to look at less than one value. In this case the sequencial search algorithm will find $K$ at the first comparison.",
      "sc6": "<br>After that the algorithm will terminate, returning 0 as the target's index.",
      "sc7": "Alternatively, if the last position in the array contains $K$, then the running time is relatively long, because the algorithm must examine $n$ values.",
      "sc8": "<br>This is the <b>worst case</b> for this algorithm, because sequential search never looks at more than each of the $n$ values in the array.",
      "sc9": "If we implement sequential search as a program and run it many times on many different arrays of size $n$, or search for many different values of $K$ within the same array, we expect the algorithm on average to go halfway through the array before finding the value we seek.",
      "sc10": "<br>On average, the algorithm examines $\\frac{n+1}{2}$ values. We call this the <b>average case</b> for this algorithm.",
      "sc11": "Putting things all together...",
      "lab1": "Sequential Search",
      "lab2": "<b><u>Best Case.</u></b> A single comparison is performed.",
      "lab3": "<b><u>Worst Case</u></b>. $n$ comparisons are performed.",
      "lab4": "<b><u>Average Case</u></b>. $\\frac{n+1}{2}$ comparisons are performed."

    }
  },
  "code" : {
    "java": [{
      "url": "../../../SourceCode/Pseudo/Searching/Sequential.txt",
      "lineNumbers": false,
      "startAfter": "/* *** ODSATag: Sequential *** */",
      "endBefore": "/* *** ODSAendTag: Sequential *** */",
      "top": 90,
      "left": 395,
      "tags": {
        "comparison": 3,
        "return": 4
      }
    }],
    "java_generic": [{
      "url": "../../../SourceCode/Pseudo/Searching/Sequential.txt",
      "lineNumbers": false,
      "startAfter": "/* *** ODSATag: Sequential *** */",
      "endBefore": "/* *** ODSAendTag: Sequential *** */",
      "top": 90,
      "left": 395,
      "tags": {
        "comparison": 3,
        "return": 4
      }
    }],
    "c++": [{
      "url": "../../../SourceCode/Pseudo/Searching/Sequential.txt",
      "lineNumbers": false,
      "startAfter": "/* *** ODSATag: Sequential *** */",
      "endBefore": "/* *** ODSAendTag: Sequential *** */",
      "top": 90,
      "left": 395,
      "tags": {
        "comparison": 3,
        "return": 4
      }
    }]
  }
}
