1. Homepage
  2. Programming
  3. Computer Science 320SC Applied Algorithmics - Programming Assignment 5: Finding partner and Killing enemies.

Computer Science 320SC Applied Algorithmics - Programming Assignment 5: Finding partner and Killing enemies.

Engage in a Conversation
AucklandCOMPSCI 320COMP320Applied AlgorithmicsMeet your partner at skyscraperDynamic ProgrammingPython

Computer Science 320SC – (2024) CourseNana.COM

Programming Assignment 5 CourseNana.COM

Academic Integrity
CourseNana.COM

Before attempting to solve the assignment, please read the message below very carefully. As described on https://academicintegrity.cs.auckland.ac.nz/, you must NOT CourseNana.COM

  • ˆ  Use all or part of another student’s solution to the assignment. Changing variable names or substituting words in a sentence does not make it your solution. CourseNana.COM

  • ˆ  Allow someone else to complete all or part of the assignment for you. CourseNana.COM

  • ˆ  Solicit answers for the assignment on contract-cheating websites such as Chegg.com and CourseNana.COM

    Bartleby.com. CourseNana.COM

  • ˆ  Use code from Internet sources such as StackOverflow or generative-AI tools such as Chat- CourseNana.COM

    GPT. You are encouraged to learn from Internet sources and tools, but you need to come up CourseNana.COM

    with your own implementation of the code to show your learning. CourseNana.COM

  • ˆ  Allow another student to copy all or part of your solution to the assignment. CourseNana.COM

  • ˆ  Do all or part of an assignment for someone else. CourseNana.COM

  • ˆ  Share code that can lead to the solution of an assignment. CourseNana.COM

  • ˆ  Post the assignment anywhere online or share it with anyone else. The assignment material CourseNana.COM

    is copyrighted and sharing or posting them online violates our copyright. CourseNana.COM

  • ˆ  Post your solution online on public websites. Your online solutions will encourage other students to copy your solution. Private GitHub repositories and other private online stor- age drives are acceptable, and you can also share your solution privately with prospective CourseNana.COM

    employers. CourseNana.COM

  • ˆ  Reuse your own work unless discussed otherwise with the lecturer. CourseNana.COM

  • ˆ  Leave your computers, devices, and belongings unattended — you must secure these at all CourseNana.COM

    times to prevent anyone having access to your assessments or solutions. CourseNana.COM

Last year, out of 218 students, there were 11 misconducted cases found on A5 - Task 1. We kept the submissions from the last few years to run MOSS at https://theory.stanford.edu/~aiken/moss/. CourseNana.COM

I hope that there will be no cases this year! CourseNana.COM

Requirements CourseNana.COM

This 5th assignment lets you get familiar with dynamic programming design and development. It is worth 5% of your total course marks. We would like you to implement efficient dynamic programming algorithms for two tasks: Task 1: Finding partner and Task 2: Killing enemies. CourseNana.COM

An excessive number of submissions (over 10) for a particular problem will accrue a 20% penalty per that problem if you eventually solve it. Therefore, please write a bruteforce algorithm and test your dynamic programming version with your own generated inputs at scale before submitting to the automated marker. CourseNana.COM

We only accept Python programs that use built-in packages (i.e. packages that do not require pip install). CourseNana.COM

1 Task 1: Meet your partner at skyscraper 1.1 Problem description CourseNana.COM

You are standing at the ground floor and your partner is waiting at the top floor of a s`kyscraper. You will have to use an algorithmically designed lift L to reach your partner. The lift L is designed in the manner that if you use the lift at the floor i, you are able to reach any floor from i+1 to i+L[i] where L[i] is a positive integer that presents the capacity of the lift at the i-th floor. Each time you use the lift costs $1. CourseNana.COM

Assume that the skyscraper has n floors and you are at the floor 0. Your partner is at the floor n 1 and waiting for you to see the sky view. The lift information L[i] for 0 i < n is available at the ground floor. Write a function to return the minimum cost, i.e. the number of time using the lift, to reach your partner. CourseNana.COM

O(n) solutions are preferred since we have set the running time limit on the automarker. 1.2 Test case description CourseNana.COM

Your input will be a sequence of n integers, each value per line corresponding to the lift information L[i] (e.g. the capacity of the lift) on the i-th floor. The first line is for the 0-th floor. The last line is for the (n 1)-th floor, which is a redundant information :-). Your output will be an integer. CourseNana.COM

There are 4 test cases. CourseNana.COM

1. Atrialtestcaseofn=10hasnomark.
2. A test case of
n = 100,000 and has 1 mark. 3. A test case of n = 1000, 000 and has 2 marks. CourseNana.COM

Sample Input 1: CourseNana.COM

8 1 3 1 3 CourseNana.COM

Sample Output 1: CourseNana.COM

1 CourseNana.COM

You only need to use the lift once since L[0] = 8 is sufficient to get you to the 4th floor. Sample Input 2: CourseNana.COM

2 5 1 4 8 CourseNana.COM

Sample Output 2: CourseNana.COM

2 CourseNana.COM

You only need to use the lift twice. The first one with L[0] = 2 to the 1st floor, and L[1] = 5 is sufficient to get you to the 4th floor. CourseNana.COM

2 Task 2: Arrange tanks to eliminate enemies 2.1 Problem description CourseNana.COM

You have a queue of n tanks hidden in a forest. Due to the UAV of enemies, only 1 tank is used per day, and the used tank can only be taken from the front or rear of the queue for some security reasons. Each tank has a number indicating the number of potential units the tank can eliminate. Since tanks are hurrily queued up during the night, you cannot organize the tank in the good order to use. Instead, you have a queue of n values, each reflects the number of potential eliminated units for each tank in the queue. CourseNana.COM

Since the war is more and more severe, the number of potential eliminated units dramatically increases day-by-day. Let the labels of the number of eliminated units from n tanks in the queue be t1, t2, . . . , tn. In the i-th day, the used tank k will eliminate i tk units. CourseNana.COM

As a commander, for each day, your task is to give an order 1 or 0 corresponding to whether the front or the rear tank in the queue is used. Write a program to compute the best order of using n tanks for n days to eliminate maximum number of enemies’ units. CourseNana.COM

Since there might be several orderings that output the same number of eliminated units, you would need to output the maximum number of eliminated units only. CourseNana.COM

You might see that the best solution runs in O(n2) time asymptotically. However, a program with low memory usage (e.g. O(n)) is preferred since the automarker has limited resources, and we have set the running time limit on the automarker. CourseNana.COM

2.2 Test case description CourseNana.COM

Your input will be a sequence of n integers, each value per line i corresponding to the amount of elimi- nated units of the tank ti. The first and last lines correspond to the front and rear tanks, respectively. Your output is an integer in range [0..231] corresponding to the maximum number of eliminated units. CourseNana.COM

There are 2 test cases. CourseNana.COM

1. Atrialtestcaseofn=10hasnomark. 2. A test case of n = 10,000 has 2 marks. CourseNana.COM

CourseNana.COM

Sample Input 1: CourseNana.COM

4 8 12 4 10 CourseNana.COM

Sample Output 1: CourseNana.COM

128 CourseNana.COM

The order is {1,0,0,1,1}, and the maximum number of detroyed units is 4 * 1 + 10 * 2 + 4 * 3 + 8 * 4+12*5=128. Notethatforthelasttank(#3),anyorderof1or0doesnotmatter. CourseNana.COM

Sample Input 2: CourseNana.COM

1 9 1 9 8 8 7 7 CourseNana.COM

Sample Output 2: CourseNana.COM

261 CourseNana.COM

The maximum number of detroyed units is 261 and the order is {1, 1, 1, 0, 0, 0, 0, 1}. Note that for the last tank (#4), any order of 1 or 0 does not matter. CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Auckland代写,COMPSCI 320代写,COMP320代写,Applied Algorithmics代写,Meet your partner at skyscraper代写,Dynamic Programming代写,Python代写,Auckland代编,COMPSCI 320代编,COMP320代编,Applied Algorithmics代编,Meet your partner at skyscraper代编,Dynamic Programming代编,Python代编,Auckland代考,COMPSCI 320代考,COMP320代考,Applied Algorithmics代考,Meet your partner at skyscraper代考,Dynamic Programming代考,Python代考,Aucklandhelp,COMPSCI 320help,COMP320help,Applied Algorithmicshelp,Meet your partner at skyscraperhelp,Dynamic Programminghelp,Pythonhelp,Auckland作业代写,COMPSCI 320作业代写,COMP320作业代写,Applied Algorithmics作业代写,Meet your partner at skyscraper作业代写,Dynamic Programming作业代写,Python作业代写,Auckland编程代写,COMPSCI 320编程代写,COMP320编程代写,Applied Algorithmics编程代写,Meet your partner at skyscraper编程代写,Dynamic Programming编程代写,Python编程代写,Aucklandprogramming help,COMPSCI 320programming help,COMP320programming help,Applied Algorithmicsprogramming help,Meet your partner at skyscraperprogramming help,Dynamic Programmingprogramming help,Pythonprogramming help,Aucklandassignment help,COMPSCI 320assignment help,COMP320assignment help,Applied Algorithmicsassignment help,Meet your partner at skyscraperassignment help,Dynamic Programmingassignment help,Pythonassignment help,Aucklandsolution,COMPSCI 320solution,COMP320solution,Applied Algorithmicssolution,Meet your partner at skyscrapersolution,Dynamic Programmingsolution,Pythonsolution,