diff --git a/practice/midterm-01.html b/practice/midterm-01.html index b891599d..8b13ddd9 100644 --- a/practice/midterm-01.html +++ b/practice/midterm-01.html @@ -3079,13 +3079,13 @@
- \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer @@ -3128,13 +3128,13 @@ Problem #166 - \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -3179,13 +3179,13 @@ Part 1) What is the best case time complexity of this code as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3200,13 +3200,13 @@ Part 2) What is the worst case time complexity of this code as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3252,13 +3252,13 @@ Problem #168 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3534,13 +3534,13 @@ Problem #176 Consider the mediansort function from above. Suppose that find_median takes \(\Theta(n)\) time. What is the time complexity of mediansort? - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -3586,13 +3586,13 @@ Problem #177 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -3682,13 +3682,13 @@ Problem #179 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3724,13 +3724,13 @@ Problem #180 - \(\Theta(n^4 \log n)\) - + \(\Theta(n^4 \log n)\) + Show Answer @@ -3757,13 +3757,13 @@ Part 1) What is a tight theoretical lower bound for this problem? Again, you may assume that the lists are both sorted. State your answer in asymptotic notation as a function of \(n\). - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3842,13 +3842,13 @@ Part 1) What is the fewest number of times that ``hello world!'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 1 - + 1 + Show Answer @@ -3863,13 +3863,13 @@ Part 2) What is the greatest number of times that ``hello world'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 10 - + 10 + Show Answer @@ -3923,13 +3923,13 @@ Problem #185 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n\) - + \(n\) + Show Answer @@ -3965,13 +3965,13 @@ Problem #186 What is the asymptotic time complexity of boo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4004,13 +4004,13 @@ Problem #187 Write \(f(n)\) in asymptotic notation in the simplest terms possible. \(f(n) = \Theta(\) - \(\sqrt n \log n\) - + \(\sqrt n \log n\) + Show Answer @@ -4034,13 +4034,13 @@ Problem #188 Suppose a collection of unique numbers is stored in a balanced binary search tree, and that each node in the tree has been given a .size attribute which contains the number of nodes in the subtree rooted at that node. What is the time complexity required of an efficient algorithm for computing the number of elements in the collection which are larger than some threshold, \(t\)? - \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -4073,13 +4073,13 @@ Problem #189 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -3179,13 +3179,13 @@ Part 1) What is the best case time complexity of this code as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3200,13 +3200,13 @@ Part 2) What is the worst case time complexity of this code as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3252,13 +3252,13 @@ Problem #168 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3534,13 +3534,13 @@ Problem #176 Consider the mediansort function from above. Suppose that find_median takes \(\Theta(n)\) time. What is the time complexity of mediansort? - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -3586,13 +3586,13 @@ Problem #177 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -3682,13 +3682,13 @@ Problem #179 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3724,13 +3724,13 @@ Problem #180 - \(\Theta(n^4 \log n)\) - + \(\Theta(n^4 \log n)\) + Show Answer @@ -3757,13 +3757,13 @@ Part 1) What is a tight theoretical lower bound for this problem? Again, you may assume that the lists are both sorted. State your answer in asymptotic notation as a function of \(n\). - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3842,13 +3842,13 @@ Part 1) What is the fewest number of times that ``hello world!'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 1 - + 1 + Show Answer @@ -3863,13 +3863,13 @@ Part 2) What is the greatest number of times that ``hello world'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 10 - + 10 + Show Answer @@ -3923,13 +3923,13 @@ Problem #185 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n\) - + \(n\) + Show Answer @@ -3965,13 +3965,13 @@ Problem #186 What is the asymptotic time complexity of boo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4004,13 +4004,13 @@ Problem #187 Write \(f(n)\) in asymptotic notation in the simplest terms possible. \(f(n) = \Theta(\) - \(\sqrt n \log n\) - + \(\sqrt n \log n\) + Show Answer @@ -4034,13 +4034,13 @@ Problem #188 Suppose a collection of unique numbers is stored in a balanced binary search tree, and that each node in the tree has been given a .size attribute which contains the number of nodes in the subtree rooted at that node. What is the time complexity required of an efficient algorithm for computing the number of elements in the collection which are larger than some threshold, \(t\)? - \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -4073,13 +4073,13 @@ Problem #189 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
What is the best case time complexity of this code as a function of \(n\)? State your answer using asymptotic notation.
- \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3200,13 +3200,13 @@ Part 2) What is the worst case time complexity of this code as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3252,13 +3252,13 @@ Problem #168 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3534,13 +3534,13 @@ Problem #176 Consider the mediansort function from above. Suppose that find_median takes \(\Theta(n)\) time. What is the time complexity of mediansort? - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -3586,13 +3586,13 @@ Problem #177 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -3682,13 +3682,13 @@ Problem #179 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3724,13 +3724,13 @@ Problem #180 - \(\Theta(n^4 \log n)\) - + \(\Theta(n^4 \log n)\) + Show Answer @@ -3757,13 +3757,13 @@ Part 1) What is a tight theoretical lower bound for this problem? Again, you may assume that the lists are both sorted. State your answer in asymptotic notation as a function of \(n\). - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3842,13 +3842,13 @@ Part 1) What is the fewest number of times that ``hello world!'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 1 - + 1 + Show Answer @@ -3863,13 +3863,13 @@ Part 2) What is the greatest number of times that ``hello world'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 10 - + 10 + Show Answer @@ -3923,13 +3923,13 @@ Problem #185 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n\) - + \(n\) + Show Answer @@ -3965,13 +3965,13 @@ Problem #186 What is the asymptotic time complexity of boo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4004,13 +4004,13 @@ Problem #187 Write \(f(n)\) in asymptotic notation in the simplest terms possible. \(f(n) = \Theta(\) - \(\sqrt n \log n\) - + \(\sqrt n \log n\) + Show Answer @@ -4034,13 +4034,13 @@ Problem #188 Suppose a collection of unique numbers is stored in a balanced binary search tree, and that each node in the tree has been given a .size attribute which contains the number of nodes in the subtree rooted at that node. What is the time complexity required of an efficient algorithm for computing the number of elements in the collection which are larger than some threshold, \(t\)? - \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -4073,13 +4073,13 @@ Problem #189 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
What is the worst case time complexity of this code as a function of \(n\)? State your answer using asymptotic notation.
- \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3252,13 +3252,13 @@ Problem #168 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3534,13 +3534,13 @@ Problem #176 Consider the mediansort function from above. Suppose that find_median takes \(\Theta(n)\) time. What is the time complexity of mediansort? - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -3586,13 +3586,13 @@ Problem #177 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -3682,13 +3682,13 @@ Problem #179 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3724,13 +3724,13 @@ Problem #180 - \(\Theta(n^4 \log n)\) - + \(\Theta(n^4 \log n)\) + Show Answer @@ -3757,13 +3757,13 @@ Part 1) What is a tight theoretical lower bound for this problem? Again, you may assume that the lists are both sorted. State your answer in asymptotic notation as a function of \(n\). - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3842,13 +3842,13 @@ Part 1) What is the fewest number of times that ``hello world!'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 1 - + 1 + Show Answer @@ -3863,13 +3863,13 @@ Part 2) What is the greatest number of times that ``hello world'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 10 - + 10 + Show Answer @@ -3923,13 +3923,13 @@ Problem #185 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n\) - + \(n\) + Show Answer @@ -3965,13 +3965,13 @@ Problem #186 What is the asymptotic time complexity of boo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4004,13 +4004,13 @@ Problem #187 Write \(f(n)\) in asymptotic notation in the simplest terms possible. \(f(n) = \Theta(\) - \(\sqrt n \log n\) - + \(\sqrt n \log n\) + Show Answer @@ -4034,13 +4034,13 @@ Problem #188 Suppose a collection of unique numbers is stored in a balanced binary search tree, and that each node in the tree has been given a .size attribute which contains the number of nodes in the subtree rooted at that node. What is the time complexity required of an efficient algorithm for computing the number of elements in the collection which are larger than some threshold, \(t\)? - \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -4073,13 +4073,13 @@ Problem #189 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3534,13 +3534,13 @@ Problem #176 Consider the mediansort function from above. Suppose that find_median takes \(\Theta(n)\) time. What is the time complexity of mediansort? - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -3586,13 +3586,13 @@ Problem #177 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -3682,13 +3682,13 @@ Problem #179 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3724,13 +3724,13 @@ Problem #180 - \(\Theta(n^4 \log n)\) - + \(\Theta(n^4 \log n)\) + Show Answer @@ -3757,13 +3757,13 @@ Part 1) What is a tight theoretical lower bound for this problem? Again, you may assume that the lists are both sorted. State your answer in asymptotic notation as a function of \(n\). - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3842,13 +3842,13 @@ Part 1) What is the fewest number of times that ``hello world!'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 1 - + 1 + Show Answer @@ -3863,13 +3863,13 @@ Part 2) What is the greatest number of times that ``hello world'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 10 - + 10 + Show Answer @@ -3923,13 +3923,13 @@ Problem #185 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n\) - + \(n\) + Show Answer @@ -3965,13 +3965,13 @@ Problem #186 What is the asymptotic time complexity of boo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4004,13 +4004,13 @@ Problem #187 Write \(f(n)\) in asymptotic notation in the simplest terms possible. \(f(n) = \Theta(\) - \(\sqrt n \log n\) - + \(\sqrt n \log n\) + Show Answer @@ -4034,13 +4034,13 @@ Problem #188 Suppose a collection of unique numbers is stored in a balanced binary search tree, and that each node in the tree has been given a .size attribute which contains the number of nodes in the subtree rooted at that node. What is the time complexity required of an efficient algorithm for computing the number of elements in the collection which are larger than some threshold, \(t\)? - \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -4073,13 +4073,13 @@ Problem #189 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
Consider the mediansort function from above. Suppose that find_median takes \(\Theta(n)\) time. What is the time complexity of mediansort?
mediansort
find_median
- \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -3586,13 +3586,13 @@ Problem #177 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -3682,13 +3682,13 @@ Problem #179 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3724,13 +3724,13 @@ Problem #180 - \(\Theta(n^4 \log n)\) - + \(\Theta(n^4 \log n)\) + Show Answer @@ -3757,13 +3757,13 @@ Part 1) What is a tight theoretical lower bound for this problem? Again, you may assume that the lists are both sorted. State your answer in asymptotic notation as a function of \(n\). - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3842,13 +3842,13 @@ Part 1) What is the fewest number of times that ``hello world!'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 1 - + 1 + Show Answer @@ -3863,13 +3863,13 @@ Part 2) What is the greatest number of times that ``hello world'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 10 - + 10 + Show Answer @@ -3923,13 +3923,13 @@ Problem #185 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n\) - + \(n\) + Show Answer @@ -3965,13 +3965,13 @@ Problem #186 What is the asymptotic time complexity of boo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4004,13 +4004,13 @@ Problem #187 Write \(f(n)\) in asymptotic notation in the simplest terms possible. \(f(n) = \Theta(\) - \(\sqrt n \log n\) - + \(\sqrt n \log n\) + Show Answer @@ -4034,13 +4034,13 @@ Problem #188 Suppose a collection of unique numbers is stored in a balanced binary search tree, and that each node in the tree has been given a .size attribute which contains the number of nodes in the subtree rooted at that node. What is the time complexity required of an efficient algorithm for computing the number of elements in the collection which are larger than some threshold, \(t\)? - \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -4073,13 +4073,13 @@ Problem #189 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -3682,13 +3682,13 @@ Problem #179 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3724,13 +3724,13 @@ Problem #180 - \(\Theta(n^4 \log n)\) - + \(\Theta(n^4 \log n)\) + Show Answer @@ -3757,13 +3757,13 @@ Part 1) What is a tight theoretical lower bound for this problem? Again, you may assume that the lists are both sorted. State your answer in asymptotic notation as a function of \(n\). - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3842,13 +3842,13 @@ Part 1) What is the fewest number of times that ``hello world!'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 1 - + 1 + Show Answer @@ -3863,13 +3863,13 @@ Part 2) What is the greatest number of times that ``hello world'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 10 - + 10 + Show Answer @@ -3923,13 +3923,13 @@ Problem #185 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n\) - + \(n\) + Show Answer @@ -3965,13 +3965,13 @@ Problem #186 What is the asymptotic time complexity of boo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4004,13 +4004,13 @@ Problem #187 Write \(f(n)\) in asymptotic notation in the simplest terms possible. \(f(n) = \Theta(\) - \(\sqrt n \log n\) - + \(\sqrt n \log n\) + Show Answer @@ -4034,13 +4034,13 @@ Problem #188 Suppose a collection of unique numbers is stored in a balanced binary search tree, and that each node in the tree has been given a .size attribute which contains the number of nodes in the subtree rooted at that node. What is the time complexity required of an efficient algorithm for computing the number of elements in the collection which are larger than some threshold, \(t\)? - \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -4073,13 +4073,13 @@ Problem #189 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3724,13 +3724,13 @@ Problem #180 - \(\Theta(n^4 \log n)\) - + \(\Theta(n^4 \log n)\) + Show Answer @@ -3757,13 +3757,13 @@ Part 1) What is a tight theoretical lower bound for this problem? Again, you may assume that the lists are both sorted. State your answer in asymptotic notation as a function of \(n\). - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3842,13 +3842,13 @@ Part 1) What is the fewest number of times that ``hello world!'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 1 - + 1 + Show Answer @@ -3863,13 +3863,13 @@ Part 2) What is the greatest number of times that ``hello world'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 10 - + 10 + Show Answer @@ -3923,13 +3923,13 @@ Problem #185 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n\) - + \(n\) + Show Answer @@ -3965,13 +3965,13 @@ Problem #186 What is the asymptotic time complexity of boo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4004,13 +4004,13 @@ Problem #187 Write \(f(n)\) in asymptotic notation in the simplest terms possible. \(f(n) = \Theta(\) - \(\sqrt n \log n\) - + \(\sqrt n \log n\) + Show Answer @@ -4034,13 +4034,13 @@ Problem #188 Suppose a collection of unique numbers is stored in a balanced binary search tree, and that each node in the tree has been given a .size attribute which contains the number of nodes in the subtree rooted at that node. What is the time complexity required of an efficient algorithm for computing the number of elements in the collection which are larger than some threshold, \(t\)? - \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -4073,13 +4073,13 @@ Problem #189 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- \(\Theta(n^4 \log n)\) - + \(\Theta(n^4 \log n)\) + Show Answer @@ -3757,13 +3757,13 @@ Part 1) What is a tight theoretical lower bound for this problem? Again, you may assume that the lists are both sorted. State your answer in asymptotic notation as a function of \(n\). - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3842,13 +3842,13 @@ Part 1) What is the fewest number of times that ``hello world!'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 1 - + 1 + Show Answer @@ -3863,13 +3863,13 @@ Part 2) What is the greatest number of times that ``hello world'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 10 - + 10 + Show Answer @@ -3923,13 +3923,13 @@ Problem #185 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n\) - + \(n\) + Show Answer @@ -3965,13 +3965,13 @@ Problem #186 What is the asymptotic time complexity of boo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4004,13 +4004,13 @@ Problem #187 Write \(f(n)\) in asymptotic notation in the simplest terms possible. \(f(n) = \Theta(\) - \(\sqrt n \log n\) - + \(\sqrt n \log n\) + Show Answer @@ -4034,13 +4034,13 @@ Problem #188 Suppose a collection of unique numbers is stored in a balanced binary search tree, and that each node in the tree has been given a .size attribute which contains the number of nodes in the subtree rooted at that node. What is the time complexity required of an efficient algorithm for computing the number of elements in the collection which are larger than some threshold, \(t\)? - \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -4073,13 +4073,13 @@ Problem #189 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
What is a tight theoretical lower bound for this problem? Again, you may assume that the lists are both sorted. State your answer in asymptotic notation as a function of \(n\).
- \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -3842,13 +3842,13 @@ Part 1) What is the fewest number of times that ``hello world!'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 1 - + 1 + Show Answer @@ -3863,13 +3863,13 @@ Part 2) What is the greatest number of times that ``hello world'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 10 - + 10 + Show Answer @@ -3923,13 +3923,13 @@ Problem #185 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n\) - + \(n\) + Show Answer @@ -3965,13 +3965,13 @@ Problem #186 What is the asymptotic time complexity of boo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4004,13 +4004,13 @@ Problem #187 Write \(f(n)\) in asymptotic notation in the simplest terms possible. \(f(n) = \Theta(\) - \(\sqrt n \log n\) - + \(\sqrt n \log n\) + Show Answer @@ -4034,13 +4034,13 @@ Problem #188 Suppose a collection of unique numbers is stored in a balanced binary search tree, and that each node in the tree has been given a .size attribute which contains the number of nodes in the subtree rooted at that node. What is the time complexity required of an efficient algorithm for computing the number of elements in the collection which are larger than some threshold, \(t\)? - \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -4073,13 +4073,13 @@ Problem #189 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
What is the fewest number of times that ``hello world!'' can possibly be printed? Your answer should be a number, and not in terms of \(n\).
- 1 - + 1 + Show Answer @@ -3863,13 +3863,13 @@ Part 2) What is the greatest number of times that ``hello world'' can possibly be printed? Your answer should be a number, and not in terms of \(n\). - 10 - + 10 + Show Answer @@ -3923,13 +3923,13 @@ Problem #185 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n\) - + \(n\) + Show Answer @@ -3965,13 +3965,13 @@ Problem #186 What is the asymptotic time complexity of boo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4004,13 +4004,13 @@ Problem #187 Write \(f(n)\) in asymptotic notation in the simplest terms possible. \(f(n) = \Theta(\) - \(\sqrt n \log n\) - + \(\sqrt n \log n\) + Show Answer @@ -4034,13 +4034,13 @@ Problem #188 Suppose a collection of unique numbers is stored in a balanced binary search tree, and that each node in the tree has been given a .size attribute which contains the number of nodes in the subtree rooted at that node. What is the time complexity required of an efficient algorithm for computing the number of elements in the collection which are larger than some threshold, \(t\)? - \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -4073,13 +4073,13 @@ Problem #189 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
What is the greatest number of times that ``hello world'' can possibly be printed? Your answer should be a number, and not in terms of \(n\).
- 10 - + 10 + Show Answer @@ -3923,13 +3923,13 @@ Problem #185 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n\) - + \(n\) + Show Answer @@ -3965,13 +3965,13 @@ Problem #186 What is the asymptotic time complexity of boo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4004,13 +4004,13 @@ Problem #187 Write \(f(n)\) in asymptotic notation in the simplest terms possible. \(f(n) = \Theta(\) - \(\sqrt n \log n\) - + \(\sqrt n \log n\) + Show Answer @@ -4034,13 +4034,13 @@ Problem #188 Suppose a collection of unique numbers is stored in a balanced binary search tree, and that each node in the tree has been given a .size attribute which contains the number of nodes in the subtree rooted at that node. What is the time complexity required of an efficient algorithm for computing the number of elements in the collection which are larger than some threshold, \(t\)? - \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -4073,13 +4073,13 @@ Problem #189 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\):
\(O(\) - \(n\) - + \(n\) + Show Answer @@ -3965,13 +3965,13 @@ Problem #186 What is the asymptotic time complexity of boo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4004,13 +4004,13 @@ Problem #187 Write \(f(n)\) in asymptotic notation in the simplest terms possible. \(f(n) = \Theta(\) - \(\sqrt n \log n\) - + \(\sqrt n \log n\) + Show Answer @@ -4034,13 +4034,13 @@ Problem #188 Suppose a collection of unique numbers is stored in a balanced binary search tree, and that each node in the tree has been given a .size attribute which contains the number of nodes in the subtree rooted at that node. What is the time complexity required of an efficient algorithm for computing the number of elements in the collection which are larger than some threshold, \(t\)? - \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -4073,13 +4073,13 @@ Problem #189 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
What is the asymptotic time complexity of boo?
boo
- \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4004,13 +4004,13 @@ Problem #187 Write \(f(n)\) in asymptotic notation in the simplest terms possible. \(f(n) = \Theta(\) - \(\sqrt n \log n\) - + \(\sqrt n \log n\) + Show Answer @@ -4034,13 +4034,13 @@ Problem #188 Suppose a collection of unique numbers is stored in a balanced binary search tree, and that each node in the tree has been given a .size attribute which contains the number of nodes in the subtree rooted at that node. What is the time complexity required of an efficient algorithm for computing the number of elements in the collection which are larger than some threshold, \(t\)? - \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -4073,13 +4073,13 @@ Problem #189 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
Write \(f(n)\) in asymptotic notation in the simplest terms possible.
\(f(n) = \Theta(\) - \(\sqrt n \log n\) - + \(\sqrt n \log n\) + Show Answer @@ -4034,13 +4034,13 @@ Problem #188 Suppose a collection of unique numbers is stored in a balanced binary search tree, and that each node in the tree has been given a .size attribute which contains the number of nodes in the subtree rooted at that node. What is the time complexity required of an efficient algorithm for computing the number of elements in the collection which are larger than some threshold, \(t\)? - \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -4073,13 +4073,13 @@ Problem #189 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
Suppose a collection of unique numbers is stored in a balanced binary search tree, and that each node in the tree has been given a .size attribute which contains the number of nodes in the subtree rooted at that node. What is the time complexity required of an efficient algorithm for computing the number of elements in the collection which are larger than some threshold, \(t\)?
.size
- \(\Theta(\log n)\) - + \(\Theta(\log n)\) + Show Answer @@ -4073,13 +4073,13 @@ Problem #189 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4111,13 +4111,13 @@ Problem #190 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4164,13 +4164,13 @@ Problem #191 What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
What is the best case time complexity of foo as a function of \(n\)? State your answer using asymptotic notation.
foo
- \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4209,13 +4209,13 @@ Problem #192 - \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- \(\Theta(n\log n)\) - + \(\Theta(n\log n)\) + Show Answer @@ -4263,13 +4263,13 @@ Problem #193 If all of the numbers that are printed are added up, what will the sum be? - 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
If all of the numbers that are printed are added up, what will the sum be?
- 24 - + 24 + Show Answer @@ -4293,13 +4293,13 @@ Problem #194 Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation. - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
Suppose a collection of \(n\) numbers is stored in a balanced binary search tree. What is the time complexity required of an efficient algorithm to calculate the mean of the collection? State your answer as a function of \(n\) in asymptotic notation.
- \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4324,13 +4324,13 @@ Problem #195 Consider the function \(g(n) = f_2(n) / f_1(n)\). Give the tightest possible upper bound on \(g(n)\): \(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
\(O(\) - \(n^2\) - + \(n^2\) + Show Answer @@ -4537,14 +4537,14 @@ Problem #200 - \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- \(\Theta(n^2)\) + \(\Theta(n^2)\) . - + Show Answer @@ -4574,13 +4574,13 @@ Problem #201 \end{cases}\] - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4630,13 +4630,13 @@ Problem #202 - \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- \(\Theta(n \log n)\) - + \(\Theta(n \log n)\) + Show Answer @@ -4671,13 +4671,13 @@ Problem #203 - \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- \(\Theta(n^5)\) - + \(\Theta(n^5)\) + Show Answer @@ -4704,13 +4704,13 @@ Part 1) What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)? - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
What is the best possible (worst case) time complexity of any algorithm for finding the smallest difference between a number in \(A\) and a number in \(B\)?
- \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -4727,13 +4727,13 @@ Part 2) - \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- \(\Theta(1)\) - + \(\Theta(1)\) + Show Answer @@ -4795,13 +4795,13 @@ Problem #206 What is the asymptotic time complexity of foo? - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
What is the asymptotic time complexity of foo?
- \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -4832,13 +4832,13 @@ Problem #207 Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible? - \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
Define \(f(n) = f_1(n) \times f_2(n) \times f_3(n)\). What is \(f(n)\), in asymptotic notation, in simplest terms possible?
- \(\Theta(n^3)\) - + \(\Theta(n^3)\) + Show Answer diff --git a/practice/midterm-02.html b/practice/midterm-02.html index c7b1162b..3380368d 100644 --- a/practice/midterm-02.html +++ b/practice/midterm-02.html @@ -1783,13 +1783,13 @@ Problem #209 Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have? - 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
Suppose an undirected graph has 16 edges. What is the smallest number of nodes it can have?
- 7 - + 7 + Show Answer @@ -1813,13 +1813,13 @@ Problem #210 Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph? - 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
Suppose a directed graph has 5 nodes and 3 edges. What is the greatest possible degree of any node in the graph?
- 4 - + 4 + Show Answer @@ -1891,13 +1891,13 @@ Problem #212 - \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- \(\Theta(n)\) - + \(\Theta(n)\) + Show Answer @@ -1940,13 +1940,13 @@ Problem #213 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\).
"Hello!"
- 10 - + 10 + Show Answer @@ -2023,13 +2023,13 @@ Problem #216 What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
What will be the finish time of node \(e\)? Assume the convention that a node's neighbors are produced in alphabetical order.
- 13 - + 13 + Show Answer @@ -2079,13 +2079,13 @@ Problem #218 - \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- \(d\) - + \(d\) + Show Answer @@ -2136,13 +2136,13 @@ Problem #220 - d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- d a b c e - + d a b c e + Show Answer @@ -2307,13 +2307,13 @@ Problem #226 What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).) - \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
What will be the fourth node popped from the priority queue? (The first node popped is the source, \(a\).)
- \(f\) - + \(f\) + Show Answer @@ -2339,13 +2339,13 @@ Problem #227 How many iterations of the outer loop will be run in the worst case? Your answer should be a number. - 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
How many iterations of the outer loop will be run in the worst case? Your answer should be a number.
- 4 - + 4 + Show Answer @@ -2396,13 +2396,13 @@ Problem #228 How many times will "Here!" be printed? - 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
How many times will "Here!" be printed?
"Here!"
- 2 - + 2 + Show Answer @@ -2428,13 +2428,13 @@ Problem #229 What is the most number of nodes that can be in the queue at any one time? - 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
What is the most number of nodes that can be in the queue at any one time?
- 8 - + 8 + Show Answer @@ -2544,13 +2544,13 @@ Problem #232 After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)? - 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
After one iteration of the outer loop of Bellman-Ford, what is the estimated distance to node \(d\)?
- 9 - + 9 + Show Answer @@ -2653,13 +2653,13 @@ Problem #236 Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have? - 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
Suppose an undirected graph has 3 connected components and 7 nodes. What is the maximum number of edges it can have?
- 10 - + 10 + Show Answer @@ -2686,13 +2686,13 @@ Problem #237 What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).) - \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
What will be the fifth node added to \(C\) by Dijkstra's algorithm? (The first node added to \(C\) is the source, \(a\).)
- \(b\) - + \(b\) + Show Answer @@ -2735,13 +2735,13 @@ Problem #238 How many times will "Hello!" be printed? Note that this is not a full DFS, and that not all nodes are reachable from \(a\). - 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- 6 - + 6 + Show Answer @@ -2767,13 +2767,13 @@ Problem #239 Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time? - 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
Suppose a BFS is performed on this graph with node \(s\) as the starting node. What is the largest number of nodes that could possibly be in the queue at any one time?
- 9 - + 9 + Show Answer @@ -2856,13 +2856,13 @@ Problem #242 - 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- 5 - + 5 + Show Answer @@ -2972,13 +2972,13 @@ Problem #246 Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same! - \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
Note: in studying, you might have come across a problem in the practice bank about ``hub and spoke'' graphs. This question is related, but not the same!
- \(\Theta(V)\) - + \(\Theta(V)\) + Show Answer @@ -3017,13 +3017,13 @@ Problem #247 - \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
- \(\Theta(n^2)\) - + \(\Theta(n^2)\) + Show Answer @@ -3074,13 +3074,13 @@ Problem #249 What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order. - 11 - + 11 +
What will be the finish time of node \(c\)? Assume the convention that a node's neighbors are produced in alphabetical order.
- 11 - + 11 +