Quicksort Pseudocode
Quicksort Implementation 1: Introducing the partition operation
questions1 = [
{
time: "2:29",
question: "Where is the pivot element after partitioning?",
answers: [
"Anywhere in the array",
"At the beginning of the array",
"At the end of the array",
"In the middle of the array",
"In its final sorted position"
],
correct: 4
},
{
time: "4:19",
question: "What is the order after partitioning?",
answers: [
"Answer and continue after you've taken the time to partition",
],
correct: 0
}
]
yt1 = new YtQuiz("KG819vbJ2pc", questions1);
yt1.html();
Quicksort Implementation 2: In-place partitioning
questions2 = [
{
time: "1:31",
question: "Write a recurrence equation for Quicksort.",
answers: [
"Answer and continue after you've written a recurrence",
],
correct: 0,
},
{
time: "5:14",
question: "How should we initialize 'i' and 'j'?",
answers: [
"i -> 0, j -> n-1",
"i -> 1, j -> n",
"i -> 1, j -> 1",
"i -> 0, j -> 0",
],
correct: 2
},
{
time: "8:34",
question: "How do we put the pivot element in its final sorted position?",
answers: [
"Swap it with the element at i",
"Swap it with the element at j",
"Do nothing",
"Swap it with the element at the end of the array",
],
correct: 0
}
]
yt2 = new YtQuiz("w72-sV1ayMU", questions2);
yt2.html();
Quicksort Implementation 3: Quicksort pseudocode
questions3 = [
{
time: "2:47",
question: "What is the base case?",
answers: [
"(left_index + 1) >= right_index",
"array.length <= 1",
],
correct: 0
},
{
time: "4:28",
question: "What do we pass to the recursive calls?",
answers: [
"Answer and continue when ready",
],
correct: null
}
]
yt3 = new YtQuiz("Fwa8J4mwkAc", questions3);
yt3.html();