1. Homepage
  2. Homework
  3. [2022] COMP3121/9101 Algorithms and Programming Techniques - Assignment 3 Maximumm Flow
This question has been solved

[2022] COMP3121/9101 Algorithms and Programming Techniques - Assignment 3 Maximumm Flow

Engage in a Conversation
COMP3121COMP9101Algorithms and Programming TechniquesAssignment 3Maximumm FlowUNSW澳洲

COMP3121/9101 22T2 — Assignment 3 (UNSW Sydney)


CourseNana.COM

Due 14th July 2022 at 4pm Sydney time CourseNana.COM

In this assignment we apply maximum flow. There are four problems each worth 20 marks, for a total of 80 marks. CourseNana.COM

Your solutions must be typed, machine readable PDF files. All submissions will be checked for plagiarism! CourseNana.COM

For each question requiring you to design an algorithm, you must justify the correctness of your algorithm. If a time bound is specified in the question, you also must argue that your algorithm meets this time bound. CourseNana.COM

You may only use maximum flow algorithms presented in this course, namely Ford- Fulkerson and Edmonds-Karp. CourseNana.COM

Partial credit will be awarded for progress towards a solution. CourseNana.COM


CourseNana.COM

Question 1 CourseNana.COM

There is an n × n grid of squares. Each square is either special, or has a positive integer cost assigned to it. No square on the border of the grid is special. CourseNana.COM

A set of squares S is said to be good if it does not contain any special squares and, starting from any special square, you cannot reach a square on the border of the grid by performing up, down, left and right moves without entering a cell belonging to S. CourseNana.COM

1.1 [5 marks] In the following diagram, squares are labelled ‘X’ if they are special, otherwise they are labelled by their cost. Identify a good set of squares with minimum total cost for this particular grid. CourseNana.COM

5349 4X36 19X4 1235 CourseNana.COM

1.2 [15 marks] Design an algorithm which receives an arbitrary n × n grid, runs in time poly- nomial in n and determines a good set of squares with minimum total cost. CourseNana.COM


CourseNana.COM

Question 2 CourseNana.COM

There are k people living in a city, whose n suburbs and m roads can be represented by an unweighted directed graph. CourseNana.COM

Every person is either slow or fast. Every night,
Each slow person can stay in the same suburb, or move along a road to an adjacent suburb. Each fast person can stay in the same suburb, or move to any other suburb in the entire city. CourseNana.COM

Over the last d days, you know how many people were located in each suburb. That is, for each day i and suburb j (where 1 i d and 1 j n), you know pi,j, the number of people located in suburb j on day i. You are guaranteed that ?nj=1 pi,j = k for all i. CourseNana.COM

2.1 [10 marks] Design an algorithm which runs in O(d(n + m)) time and determines whether there could possibly be at least one slow person. CourseNana.COM

2.2 [10 marks] Design an algorithm which runs in time polynomial in n, m, and d, and deter- mines the minimum possible number of fast people. CourseNana.COM


CourseNana.COM

Question 3 CourseNana.COM

There n boys and n girls at a party. Whenever a song starts, they will form exactly n pairs to dance. No boy will dance with the same girl twice. CourseNana.COM

Some pairs of boys and girls like each other, and all other pairs of boys and girls dislike each other. Every boy will dance with at most k girls that he dislikes, and each girl will dance with at most k boys that she dislikes, where k < n. CourseNana.COM

As the DJ, your job is to determine the maximum number of songs you can play, such that it is possible for pairs to be formed for all songs according to the above requirements. CourseNana.COM

Design an algorithm which achieves this and runs in time polynomial in n: CourseNana.COM

  1. 3.1  [10 marks] for k = 0.
  2. 3.2  [10 marks] for arbitrary k.

You may choose to skip 3.1, in which case we will mark your submission for 3.2 as if it was submitted for 3.1 also. CourseNana.COM


Question 4 CourseNana.COM

You are given a flow network G with n vertices, including a source s and sink t, and m directed edges with integer capacities. CourseNana.COM

Your friend will ask you several queries of the form: “If an edge were to be added to G, going from vertex a to vertex b with capacity c, what would the maximum flow of the modified network be?” Note that each query considers adding an edge to the original flow network, so the modified network has m + 1 edges. CourseNana.COM

Before asking any queries, your friend gives you some time to prepare, which you can spend on precomputation. CourseNana.COM

Design an algorithm which performs any required precomputation and then answers each query in constant time, subject to the following restrictions: CourseNana.COM

  1. 4.1  [5 marks] O(nm2) precomputation; b = t and c = 1 in all queries.
  2. 4.2  [6 marks] O(nm2) precomputation; c = 1 in all queries.
  3. 4.3  [7 marks] O(n2m2) precomputation; b = t in all queries.
  4. 4.4  [2 marks] O(n2m2) precomputation; queries unrestricted.

  CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
COMP3121代写,COMP9101代写,Algorithms and Programming Techniques代写,Assignment 3代写,Maximumm Flow代写,UNSW代写,澳洲代写,COMP3121代编,COMP9101代编,Algorithms and Programming Techniques代编,Assignment 3代编,Maximumm Flow代编,UNSW代编,澳洲代编,COMP3121代考,COMP9101代考,Algorithms and Programming Techniques代考,Assignment 3代考,Maximumm Flow代考,UNSW代考,澳洲代考,COMP3121help,COMP9101help,Algorithms and Programming Techniqueshelp,Assignment 3help,Maximumm Flowhelp,UNSWhelp,澳洲help,COMP3121作业代写,COMP9101作业代写,Algorithms and Programming Techniques作业代写,Assignment 3作业代写,Maximumm Flow作业代写,UNSW作业代写,澳洲作业代写,COMP3121编程代写,COMP9101编程代写,Algorithms and Programming Techniques编程代写,Assignment 3编程代写,Maximumm Flow编程代写,UNSW编程代写,澳洲编程代写,COMP3121programming help,COMP9101programming help,Algorithms and Programming Techniquesprogramming help,Assignment 3programming help,Maximumm Flowprogramming help,UNSWprogramming help,澳洲programming help,COMP3121assignment help,COMP9101assignment help,Algorithms and Programming Techniquesassignment help,Assignment 3assignment help,Maximumm Flowassignment help,UNSWassignment help,澳洲assignment help,COMP3121solution,COMP9101solution,Algorithms and Programming Techniquessolution,Assignment 3solution,Maximumm Flowsolution,UNSWsolution,澳洲solution,