Graph Representations
Graph Representations 1: Edge Lists
questions1 = [
{
time: "3:03",
question: "How long does it take to count the number of vertices?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 1
},
{
time: "4:38",
question: "How long does it take to count the number of edges?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 2
},
{
time: "4:59",
question: "How long does it take to add a vertex?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 2
},
{
time: "5:57",
question: "How long does it take to add an edge?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 2
},
{
time: "6:24",
question: "How long does it take to check for an edge?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 1
},
{
time: "7:40",
question: "How long does it take to find all neighbors?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 1
},
{
time: "8:50",
question: "How much memory does it use?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 1
},
]
yt1 = new YtQuiz("zxxSiNtGkGk", questions1);
yt1.html();
Graph Representations 2: Adjacency Matrices
questions2 = [
{
time: "2:42",
question: "How long does it take to count the number of vertices?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 3
},
{
time: "3:08",
question: "How long does it take to count the number of edges?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n^2)",
],
correct: 3
},
{
time: "3:50",
question: "How long does it take to add a vertex?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 0
},
{
time: "4:45",
question: "How long does it take to add an edge?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 2
},
{
time: "5:59",
question: "How long does it take to check for an edge?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 2
},
{
time: "6:21",
question: "How long does it take to find all neighbors?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 0
},
{
time: "7:14",
question: "How much memory does it use?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n^2)",
],
correct: 3
},
]
yt2 = new YtQuiz("eg3INJdEr7g", questions2);
yt2.html();
Graph Representations 3: Adjacency Lists
questions3 = [
{
time: "1:01",
question: "How long does it take to count the number of vertices?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 2
},
{
time: "1:14",
question: "How long does it take to count the number of edges?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n^2)",
],
correct: 0
},
{
time: "2:01",
question: "How long does it take to add a vertex?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 2
},
{
time: "2:18",
question: "How long does it take to add an edge?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 2
},
{
time: "3:16",
question: "How long does it take to check for an edge?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 1
},
{
time: "4:22",
question: "How long does it take to find all neighbors?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n+m)",
],
correct: 2
},
{
time: "5:30",
question: "How much memory does it use?",
answers: [
"O(n)",
"O(m)",
"O(1)",
"O(n + m)",
],
correct: 3
},
]
yt3 = new YtQuiz("HzbxFCrZ47w", questions3);
yt3.html();