Heaps
Heaps 1: Introduction
questions1 = [
{
time: 47,
question: "What are some data structures that you already know?",
answers: [ ],
correct: "Any response is fine! Continue when ready."
},
{
time: "1:15",
question: "Press continue when ready.",
answers: [ ],
correct: "Press continue when ready."
},
]
yt1 = new YtQuiz("0Y3HbNvu6VA", questions1);
yt1.html();
Heaps 2: Applications
questions2 = [
{
time: "1:48",
question: "What is the running time of selection sort?",
answers: [
"O(n)",
"O(n lg n)",
"O(n^2)"
],
correct: 2
},
{
time: "3:19",
question: "How can we make selection sort faster?",
answers: [ ],
correct: "We can use a heap to extract the next smallest (or largest) element."
},
]
yt2 = new YtQuiz("EOdC7nWBYfw", questions2);
yt2.html();
Heaps 3: Heap Implementation Concepts
questions3 = [
{
time: 40,
question: "Why should we prefer an array over pointers?",
answers: [ ],
correct: "Arrays are more cache-friendly and generally faster."
},
{
time: "1:38",
question: "Where is the minimum key?",
answers: [
"There is no way to know.",
"At the root.",
"At one of the leaves."
],
correct: 1
},
{
time: "4:31",
question: "Continue when ready.",
answers: [ ],
correct: "Continue when ready."
},
{
time: "5:19",
question: "How do you compute the index of a node's parent?",
answers: [ ],
correct: "Continue when ready."
},
{
time: "6:37",
question: "How do you compute the indices of a node's children?",
answers: [ ],
correct: "Continue when ready."
},
]
yt3 = new YtQuiz("bDP87xCcD8Y", questions3);
yt3.html();
Heaps 4: Heap Operation Examples
questions4 = [
{
time: 12,
question: "Where should we put the '7'?",
answers: [
"At the beginning of the array (shift everything right)",
"Choose an index at random",
"Place it at the end of the array"
],
correct: 2
},
{
time: "2:54",
question: "What is the running time of an insert?",
answers: [
"O(1)",
"O(lg n)",
"O(n)",
],
correct: 1
},
{
time: "4:24",
question: "What node should replace the extracted root of the tree?",
answers: [
"The child with the larger key",
"The child with the smaller key",
"The final element in the array"
],
correct: 2
},
]
yt4 = new YtQuiz("GD_T668MVaA", questions4);
yt4.html();