{
  "translations" :{
    "en": {
      "sc1": "The input is a sorted array, and in this example we will search for the record with key value 45. We will put a marker above 45 as a reminder that this is what we are searching for.",
      "sc2": "We begin searching by considering the entire array, since we don't know where the value is that we are looking for. We indicate this fact by setting the left and right bounds to the ends of the array, at positions 0 and 15, respectively.",
      "sc3": "First step is to compute the position in the middle of the current subarray. We add the position of the left bound to the position of the right bound and divide by 2, giving us position 7. Look at the value in position 7, which is 41.",
      "sc4": "Since 41 is less then 45, we know that no values to the left of position 7 will have value 45. So we keep the right bound as it was, and move the left bound to position 8.",
      "sc5": "Now we compute the middle position between the current bounds (between array positions 8 and 15). Add the left bound value to the right bound value and divide the result by 2. This gives us index 11. Look at the value in position 11, which is 56.",
      "sc6": "Since 56 is larger then 45, we will keep the current left bound and move the right bound to position 10.",
      "sc7": "Now we compute the middle position between the current bounds (between array positions 8 and 10). Add the left bound value to the right bound value and divide the result by 2. This gives us index 9. Look at the value in position 9, which is 51.",
      "sc8": "Since 51 is larger then 45, we will keep the current left bound and move the right bound to position 8.",
      "sc9": "Now we compute the middle position between the current bounds (which is now only position 8). Add the left bound value to the right bound value and divide the result by 2. This gives us index 8. Look at the value in position 8, which is 45.",
      "sc10": "We have now found value 45, which is what we are looking for.",
      "sc11": "Note that if the value in position 8 had not been what we were looking for, we still would have stopped searching at this point because there is nowhere else to look. In that case, we would have returned the length of the array as a signal that the value is not there.",
      "sc12": "During the course of the binary search, we looked at the values in 4 array positions (shown in red)."
    }
  },
  "code" : {
    "java": {
      "url": "../../../SourceCode/Java/Searching/Bsearch.java",
      "startAfter": "/* *** ODSATag: BinarySearch *** */",
      "endBefore": "/* *** ODSAendTag: BinarySearch *** */",
      "lineNumbers": false,
      "tags": {
        "sig": 3,
        "init": [4, 5],
        "while": 6,
        "compute": 7,
        "right": 8,
        "left": 9,
	"found": 10,
        "return": 12
      }
    },
    "java_generic": {
      "url": "../../../SourceCode/Java_Generic/Searching/Bsearch.java",
      "startAfter": "/* *** ODSATag: BinarySearch *** */",
      "endBefore": "/* *** ODSAendTag: BinarySearch *** */",
      "lineNumbers": false,
      "tags": {
        "sig": 3,
        "init": [4, 5],
        "while": 6,
        "compute": 7,
        "right": 8,
        "left": 9,
	"found": 10,
        "return": 12
      }
    },
    "c++": {
      "url": "../../../SourceCode/C++/Searching/Bsearch.cpp",
      "lineNumbers": false,
      "tags": {
        "sig": 3,
        "init": [4, 5],
        "while": 6,
        "compute": 7,
        "right": 8,
        "left": 9,
	"found": 10,
        "return": 12
      }
    }
  }
}
