日本欧洲视频一区_国模极品一区二区三区_国产熟女一区二区三区五月婷_亚洲AV成人精品日韩一区18p

COMP2013代做、代寫Data Structures and Algorithms
COMP2013代做、代寫Data Structures and Algorithms

時間:2024-04-24  來源:  作者: 我要糾錯



COMP2013 Data Structures and Algorithms
Programming Assignment 2 Deadline: 10:00am, 22th April, 2024
Instructions
 Submit the soft-copy of your program to Learn@PolyU
 You can only submit one program file (either C++ or Java or Python),
and the filename must follow the format below.
Language Filename format Filename example
C++ mainStudentID.cpp main10987654d.cpp
Java mainStudentID.java main10987654d.java
Python mainStudentID.py main10987654d.py
- We only accept file types in .cpp, .java, .py. We do not accept file types like .ipynb, .h, etc.
Section 1. Problem
You have n pipes with lengths in meters. You need to connect all these pipes into one pipe. You can
connect two pipes into one at a time. For two pipes with length i and j meters respectively, the cost to
connect them is 𝑡𝑡(𝑖𝑖,𝑗𝑗) = 𝑚𝑚𝑚𝑚𝑚𝑚(𝑖𝑖,𝑗𝑗) + 3; the connected pipe has length i+j meters.
The task is to minimize the total cost to connect all n pipes into one pipe, where the total cost is the sum
of all connection costs.
Example: you have 4 pipes in length 6, 5, 2, 8. After connecting all pipes, you will get one pipe with
length 21 meters. Your task is to minimize the total cost to connect these pipes into one. There can be
different ways to perform the connections. Given 4 pipes, there are  
4
2  ×  
3
2  = 18 ways to perform the
connections, and below shows one possible way (not with optimal cost),
- Connect pipes with length 6,5 first, with cost 9, and result in three pipes with length 11,2,8
- Then connect pipes with length 11, 2, with cost 14, and result in two pipes with length 13, 8
- Then connect pipes with length 13, 8, with cost 16, and result in one pipe with length 21.
- The total cost of the connections above is 9+14+16=39.
For this example, an optimal way to connect pipes should have minimum cost 34.
Given n pipes, implement a greedy algorithm that can correctly obtain the minimum total cost to connect
them into one pipe, adhering to the requirements above. Your program should have time complexity
O(nlogn). (You do not need to prove the optimality of your greedy algorithm.)
Section 2. input and output of your format
In the table below, it shows a sample of the input file and the output of your program. Your program
should take as input a filename (e.g., file1.txt), and then read the integers (one integer per line) in the file.
These integers are the length of pipes. The number of non-empty lines in the file is the number of pipes
you need to handle.
Your program will output an integer value to the screen, which is the minimum cost obtained by your
program.
Sample input file “file1.txt” The output on screen (stdout)
6 34
5
2
8
We will run your program by a command line like:
where the argument “file1.txt” is an example of the input filename.
Your program should only output the result number.
Please follow the above output format and DO NOT print any extra information.
Notes:
- We will use 10 test cases to grade your program
- The pipe length is positive integer in range [1, 1000]
- In a test case, the number of pipes is at most 10000.
Implementation Instructions:
In your implementation, you can use existing libraries that support data structures like list, stack, queue,
min-heap, max-heap, priority-queue, etc. (In other words, you do not need to implement these
fundamental data structures)
You are allowed to use operator or standard library function (e.g., in C++, Java, Python) to perform
lexicographic comparison for string. Examples:
• C++: https://cplusplus.com/reference/string/string/compare/
• Java: https://docs.oracle.com/javase/tutorial/java/data/comparestrings.html
• Python: https://docs.python.org/3/library/stdtypes.html#comparisons
Section 3: Grading Criteria
Naming conventions, compilation and execution commands
 Before submission, rename your program to
 mainStudentID.cpp, e.g., main10987654d.cpp
 OR mainStudentID.java, e.g., main10987654d.java
 OR mainStudentID.py, e.g., main10987654d.py
 [C++ and Java only] Make sure that you can compile your program using the command:
 g++ mainStudentID.cpp -o mainStudentID
 OR javac mainStudentID.java
o No marks will be given if your program cannot be compiled.
Language Command line
C++ (after compilation) ./mainStudentID file1.txt
Java (after compilation) java mainStudentID file1.txt
Python python mainStudentID.py file1.txt
 We will run your program by a command line like:
 ./mainStudentID file1.txt
 OR java mainStudentID file1.txt
OR python mainStudentID.py file1.txt
where the argument “file1.txt” is an example of the input filename.
Make sure that you can execute the above commands on the COMP apollo server successfully.
Otherwise, no marks will be given. The current versions on apollo are as follows:
g++ (GCC) 4.8.5, javac 1.8.0_20, Python 2.7.5
Test files for grading
Total marks: 100 marks
Your program will be graded by using 10 test files.
For each test case, if your program can return the correct output within 1 minute, it is a successful case
and you get 10 marks. Otherwise, this is a failed case with 0 marks.
- The running time of your program will be measured on the COMP apollo server.
If your program is not a greedy approach, extra 50 marks will be deducted from the total marks you
get from the 10 test cases above. Final grade of the assignment is in the range [0,100].
Appendix
(1) How to activate your COMP account?
Please click the following link to activate your COMP account:
https://acct.comp.polyu.edu.hk/
according to the instructions in:
https://acct.comp.polyu.edu.hk/files/COMPStudentAccountSelfActivation.pdf
(2) How to login the COMP apollo server?
[Step 1]
Use PuTTY (or any SSH client
program)
Enter the host name
csdoor.comp.polyu.edu.hk
Click the “Open” button.
If you see the message “The host
key is not cached for this
server…”,
just accept to continue.
[Step 2]
Enter your COMP account
username and password.
Note that, when you are entering
the password, it is not displayed
in PuTTY.
[Step 3]
Enter the hostname apollo
Then enter your COMP account
password (the same as in Step 2).
[Step 4]
Use WinSCP (or any SFTP client program).
Enter the host name csdoor.comp.polyu.edu.hk
Enter your COMP account username and password.
Upload your program to the server.

請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp









 

標簽:

掃一掃在手機打開當前頁
  • 上一篇:代寫DTS101TC、代做Python設計編程
  • 下一篇:CS 161代做、Java/Python程序代寫
  • 無相關信息
    昆明生活資訊

    昆明圖文信息
    蝴蝶泉(4A)-大理旅游
    蝴蝶泉(4A)-大理旅游
    油炸竹蟲
    油炸竹蟲
    酸筍煮魚(雞)
    酸筍煮魚(雞)
    竹筒飯
    竹筒飯
    香茅草烤魚
    香茅草烤魚
    檸檬烤魚
    檸檬烤魚
    昆明西山國家級風景名勝區
    昆明西山國家級風景名勝區
    昆明旅游索道攻略
    昆明旅游索道攻略
  • NBA直播 短信驗證碼平臺 幣安官網下載 歐冠直播 WPS下載

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 kmw.cc Inc. All Rights Reserved. 昆明網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    日本欧洲视频一区_国模极品一区二区三区_国产熟女一区二区三区五月婷_亚洲AV成人精品日韩一区18p

              这里只有视频精品| 久久久xxx| 国产精品实拍| 久久精品电影| 亚洲国产精品t66y| 国产精品白丝jk黑袜喷水| 国产精品福利久久久| 国内精品久久久久影院优 | 亚洲精品社区| 国产精品初高中精品久久| 永久免费视频成人| 欧美日韩一区免费| 久久精品在线| 一片黄亚洲嫩模| 狠狠色综合播放一区二区| 国产色综合网| 欧美日韩不卡一区| 久久国产天堂福利天堂| 欧美精品1区| 欧美在线视频播放| 亚洲美女精品一区| 国产一区二区av| 欧美日韩国产欧| 久久久久欧美精品| 亚洲国产婷婷| 韩日精品视频| 国产精品视频最多的网站| 亚洲日本激情| 极品av少妇一区二区| 午夜在线观看欧美| 一区二区欧美国产| 91久久精品一区二区三区| 久久久国产精彩视频美女艺术照福利| 亚洲国产精品美女| 国产在线精品二区| 国产精品久久久91| 欧美日韩一区成人| 欧美激情一区二区三区全黄 | 欧美一区二区三区四区高清| 欧美成人午夜激情| 久久aⅴ国产紧身牛仔裤| 国产精品一卡二卡| 国产精品vvv| 欧美极品在线播放| 欧美诱惑福利视频| 欧美一区免费| 亚洲欧美日本精品| 亚洲一区二区三区精品动漫| 欧美视频一区二区在线观看 | 欧美日韩国产在线| 欧美黄污视频| 欧美激情四色 | 亚洲国产精品高清久久久| 亚洲欧美日韩在线观看a三区| 欧美日韩在线免费视频| 亚洲欧洲另类国产综合| 男人天堂欧美日韩| 欧美日韩国产小视频在线观看| 亚洲男人影院| 久久久福利视频| 欧美黑人多人双交| 国产欧美一级| 亚洲国产日韩一区| 性伦欧美刺激片在线观看| 亚洲国产一区在线| 亚洲欧美在线高清| 欧美成ee人免费视频| 午夜精品久久久久久99热软件| 在线不卡中文字幕| 制服诱惑一区二区| 久久久在线视频| 欧美日韩国产免费观看| 美腿丝袜亚洲色图| 国产精品久久久久久户外露出| 久久久久久久久伊人| 欧美专区第一页| 欧美日韩精品免费看| 久久综合九色欧美综合狠狠| 亚洲欧美电影院| 欧美成人首页| 韩国精品在线观看| 亚洲一区二区在线免费观看视频| 欧美色道久久88综合亚洲精品| 久久夜色精品国产噜噜av| 午夜精品国产| 欧美日韩精品二区第二页| 免费成人网www| 国产欧美日韩精品专区| 国产精品毛片高清在线完整版| 欧美日韩国产在线播放| 欧美高清在线一区| 在线观看欧美| 欧美一区二区三区视频在线观看 | 欧美激情片在线观看| 免费看精品久久片| 国产一区二区三区成人欧美日韩在线观看 | 国产一二三精品| 一区二区三区免费看| 亚洲午夜精品久久| 欧美午夜免费影院| 99av国产精品欲麻豆| 日韩午夜在线| 欧美精品一区二区三区很污很色的| 欧美.www| 亚洲国产精品欧美一二99| 亚洲第一黄网| 欧美成人精品在线观看| 欧美国产综合一区二区| 欧美日韩a区| 99精品视频免费观看| 亚洲视频在线播放| 欧美视频一区在线观看| 国产麻豆成人精品| 欧美影院成年免费版| 免费欧美在线| 99精品热6080yy久久| 亚洲免费中文字幕| 国产日韩欧美黄色| 久久激情视频| 亚洲高清视频中文字幕| 一本在线高清不卡dvd| 亚洲欧美日韩国产中文| 久久天堂成人| 亚洲免费福利视频| 国产精品女主播在线观看| 伊人春色精品| 欧美日韩免费观看一区=区三区| 国产精品视频一区二区高潮| 一区二区亚洲精品国产| 一区二区三区欧美在线| 久久精品国产亚洲5555| 欧美麻豆久久久久久中文| 国产日韩综合| 欧美福利一区二区| 午夜精品久久99蜜桃的功能介绍| 蜜桃视频一区| 亚洲综合欧美日韩| 亚洲第一狼人社区| 国产精品一区久久| 欧美黄在线观看| 久久精品av麻豆的观看方式| 欧美午夜精品久久久| 91久久在线观看| 国产女人精品视频| 欧美电影在线播放| 香蕉成人久久| 夜夜嗨av色一区二区不卡| 久久视频在线视频| 午夜精彩国产免费不卡不顿大片| 欧美精品一区二区三区蜜桃| 亚洲国产精品高清久久久| 久久精品成人一区二区三区蜜臀| 欧美性片在线观看| 欧美成人日韩| 久久亚洲一区二区三区四区| 国产情侣一区| 国产精品青草综合久久久久99 | 久久综合精品一区| 午夜精品福利一区二区蜜股av| 欧美日韩高清在线播放| 91久久精品网| 在线播放日韩| 黑人操亚洲美女惩罚| 久久国产精品99国产精| 国产一区二区福利| 国产精品久久久久久久久免费 | 欧美特黄a级高清免费大片a级| 日韩亚洲欧美在线观看| 欧美精品一线| 欧美精品1区2区3区| 一区二区三区视频免费在线观看| 欧美日韩激情小视频| 日韩一级在线观看| 99国产精品视频免费观看| 国产精品99一区二区| 亚洲欧美日韩精品综合在线观看| 国产精品日韩欧美一区二区三区 | 国产精品理论片| 欧美亚州韩日在线看免费版国语版| 亚洲午夜久久久| 亚洲一区成人| 亚洲欧美亚洲| 久久精品av麻豆的观看方式| 在线看国产日韩| 在线观看日韩专区| 亚洲国产精品视频一区| 欧美日韩情趣电影| 欧美日韩亚洲一区三区| 欧美伊久线香蕉线新在线| 在线欧美日韩| 亚洲激情在线| 亚洲一区二区三区四区中文| 国产一区二区三区黄视频| 欧美电影电视剧在线观看| 正在播放欧美一区| 久久成人免费日本黄色| 日韩香蕉视频| 午夜精品一区二区三区四区| 亚洲欧洲精品成人久久奇米网| 国产精品入口|