You are given an array in which each number from 1 to N appears precisely once, with the exception of one missing number. In O(N) time, how can you locate the missing number? There are steps in hill-climbing algorithms that make a lot of progress and steps that make very little progress. For example, the first iteration on the input in Figure 15.2 may uncover a path across the augmentation graph that can be used to add a flow of 30. It may, however, discover a way via which only a flow of two may be added. How long would the calculation take if it is unfortunate enough to always take the worst allowable step permitted by the algorithm?Start by taking the step that increases the flow by 2 for the input . Then continue to take the worst possible step. You could draw out each and every step, but it is better to use this opportunity to use loop invariants. What does the flow look like after i iterations? Repeat this process on the same graph except that the four edges forming the square now have capacities 1,000,000,000,000,000 and the crossover edge has capacity 1. (Also move t to c or give that last edge a large capacity.) 1. What is the worst case number of iterations of this network flow algorithm as a function of the number of edges m in the input network? 2. What is the official “size” of a network? 3. What is the worst case number of iterations of this network flow algorithm as a function of the size of the input network? 0( 1) space? What if there were two numbers missing?

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 24PE
icon
Related questions
Question

You are given an array in which each number from 1 to N appears precisely once, with the exception of one missing number. In O(N) time, how can you locate the missing number? There are steps in hill-climbing algorithms that make a lot of progress and steps that make very little progress. For example, the first iteration on the input in Figure 15.2 may uncover a path across the augmentation graph that can be used to add a flow of 30. It may, however, discover a way via which only a flow of two may be added. How long would the calculation take if it is unfortunate enough to always take the worst allowable step permitted by the algorithm?Start by taking the step that increases the flow by 2 for the input . Then continue to take the worst possible step. You could draw out each and every step, but it is better to use this opportunity to use loop invariants. What does the flow look like after i iterations? Repeat this process on the same graph except that the four edges forming the square now have capacities 1,000,000,000,000,000 and the crossover edge has capacity 1. (Also move t to c or give that last edge a large capacity.)
1. What is the worst case number of iterations of this network flow algorithm as a
function of the number of edges m in the input network?
2. What is the official “size” of a network?
3. What is the worst case number of iterations of this network flow algorithm as a
function of the size of the input network?
0( 1) space? What if there were two numbers missing?

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning