{
  "translations": {
    "en": {
      "Slide 1": "To analyze Quicksort, we first analyze the findpivot and partition functions when operating on a subarray of length $k$",
      "Slide 2": "Clearly, findpivot takes constant time for any $k$. Here we have $k = 9$",
      "Slide 4": "The total cost of the partition operation is constrained by how far left and right can move inwards",
      "Slide 5": "The swap operation in the body of the outer while loop guarantees the movement of left and right at least one step each",
      "Slide 6": "Thus, the maximum number of times swap can be executed is $\\frac{s-1}{2}$. In this case, left and right will move at most $\\frac{s-1}{2}$ steps each for a total of $s-1$ steps",
      "Slide 7": "The first inner while loop can be executed at most $s-1$ times in which case left will end up at the pivot and the outer while loop will end",
      "Slide 8": "The second inner while loop can be executed at most $s-1$ times in which case right will end up at array position $-1$ and the outer while loop will end",
      "Slide 9": "Accordingly, the outer while loop along with its two inner loops will move left and right a total of $s-1$ steps",
      "Slide 10": "Thus, the running time of the partition function is $\\theta(s)$, where $s$ is the size of the subarray",
      "lab1": "Pivot",
      "lab2": "Left",
      "lab3": "Right"
    }
  },
  "code": {
    "java": {
      "url": "../../../SourceCode/Java/Sorting/Quicksort.java",
      "lineNumbers": false,
      "startAfter": "/* *** ODSATag: partition *** */",
      "endBefore": "/* *** ODSAendTag: partition *** */",
      "top": 120,
      "left": 120,
      "tags": {
        "loops": [2, 3, 4],
        "loop1": 2,
        "loop2": 3,
        "loop3": 4,
        "if": 5
      }
    }
  }
}
