Assume that you are given a function called dijkstra (G, a) which takes a graph G,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Assume that you are given a function called dijkstra (G, a) which takes a graph G, and a source vertex a as input, then finds the shortest path (distances, dist and parents, par) from a to every other vertex in the graph. Use this function to solve problems #1 Present your solution idea with a pseudocode, accompanying necessary explanation. Problem #1: Optimum meeting place You, and your friend Benji, live in a city which has 50 areas numbered from 1 to 50. Some of the areas are connected by bi-directional roads of various lengths. Your house is in 1 and Benji's is in 50. Both of you want to meet. Now propose an algorithm to choose the meeting point that minimizes the total travel time. In other words, if the meeting area you chose is X, it has the minimum dist(1, X) + dist(50, X) among all possible area choices. Expected complexity: 0(V + E) Assume that you are given a function called dijkstra (G, a) which takes a graph G, and a source vertex a as input, then finds the shortest path (distances, dist and parents, par) from a to every other vertex in the graph. Use this function to solve problems #1 Present your solution idea with a pseudocode, accompanying necessary explanation. Problem #1: Optimum meeting place You, and your friend Benji, live in a city which has 50 areas numbered from 1 to 50. Some of the areas are connected by bi-directional roads of various lengths. Your house is in 1 and Benji's is in 50. Both of you want to meet. Now propose an algorithm to choose the meeting point that minimizes the total travel time. In other words, if the meeting area you chose is X, it has the minimum dist(1, X) + dist(50, X) among all possible area choices. Expected complexity: 0(V + E)
Expert Answer:
Answer rating: 100% (QA)
Certainly To solve the problem of finding the optimum meeting place with minimum total travel time y... View the full answer
Related Book For
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss
Posted Date:
Students also viewed these accounting questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
QUIZ... Let D be a poset and let f : D D be a monotone function. (i) Give the definition of the least pre-fixed point, fix (f), of f. Show that fix (f) is a fixed point of f. [5 marks] (ii) Show that...
-
Prepare a personal SWOT analysis (Your personal Strengths and Weaknesses and the external macroeconomic Opportunities and Threats that all of your competitors will assess criteria examples Advantages...
-
A convex lens with 1 = 20.0 cm is mounted 40.0 cm to the left of a concave lens. When an object is placed 30.0 cm to the left of the convex lens, a real image is formed 60.0 cm to the right of the...
-
In 1942, Boris Podolsky proposed a generalization of electrostatics that eliminates the divergence of the Coulomb field for a point charge. His theory retains E = 0 but replaces Gauss law by (a)...
-
The IRR of this investment is located at which point? a. A b. C c. D d. E
-
Private College Transactions. Elizabeth College, a small private college, had the following transactions in fiscal year 2011. 1. Billings for tuition and fees totaled $5,600,000. Tuition waivers and...
-
Who developed the relational model, when, and why?
-
The Ace Trucking Company must determine the number of drivers and trucks to have available on a weekly basis. The standard schedule is to send drivers over the pickup and delivery route on Monday and...
-
Part What is the company's operating cycle? How does it compare to the industry average of 72 days? (2 Marks) What is the company's cash conversion cycle? How does it compare to the industry average...
-
We fi nd price by dividing _______. a) total revenue by output b) output by total revenue c) total cost by output d) output by total cost
-
The market demand for a good will decrease ______. a) as income decreases if the good is an inferior good b) if the market price of a substitute good increases c) as income decreases if the good is a...
-
Movie tickets and DVD rentals are ______ services. a) inferior b) complementary c) substitute d) highly inelastic
-
The marginal cost curve intersects the average variable cost curve at the ______. a) shut-down point b) break-even point c) maximum profi t point
-
Which statement is false? a) AFC plus AVC equals ATC. b) Marginal cost equals AVC at an output of one. c) AVC equals ATC at an output of one. d) None of the above.
-
Use the following tables to answer the questions below on performance evaluation. The first table is the budget, and the second table is the actual results for the year. Round amounts to dollars and...
-
Suppose that A is an m n matrix with linearly independent columns and the linear system LS(A, b) is consistent. Show that this system has a unique solution.
-
Suppose that G = (V, E) is a tree, s is the root, and we add a vertex t and edges of infinite capacity from all leaves in G to t. Give a linear-time algorithm to find a maximum flow from s to t.
-
Write a program to evaluate a postfix expression.
-
Construct a permutation of 20 elements that is as bad as possible for quicksort using median-of-three partitioning and a cutoff of 3.
-
Figure 7.20 shows a hydraulic system of two interconnected tanks that have the same cross-sectional area of \(A\). A pump is connected to tank 1. Assume that the relationship between the voltage...
-
Plot the specified output by using the RK4 method. \(3 \ddot{x}+\dot{x}+x^{3}=\frac{4}{3}, x(0)=\frac{1}{3}, \dot{x}(0)=0,0 \leq t \leq 20\), output: \(\dot{x}\)
-
A linear system is modeled as \[\frac{2}{5} \dot{x}+3 x=\frac{5}{3} u(t)+u_{r}(t), \quad x(0)=0\] where \(u(t)\) and \(u_{r}(t)\) denote the unit-step and unit-ramp functions, respectively. a....
Study smarter with the SolutionInn App