亚洲十八**毛片_亚洲综合影院_五月天精品一区二区三区_久久久噜噜噜久久中文字幕色伊伊 _欧美岛国在线观看_久久国产精品毛片_欧美va在线观看_成人黄网大全在线观看_日韩精品一区二区三区中文_亚洲一二三四区不卡

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)-大理旅游
    油炸竹蟲
    油炸竹蟲
    酸筍煮魚(雞)
    酸筍煮魚(雞)
    竹筒飯
    竹筒飯
    香茅草烤魚
    香茅草烤魚
    檸檬烤魚
    檸檬烤魚
    昆明西山國家級風景名勝區
    昆明西山國家級風景名勝區
    昆明旅游索道攻略
    昆明旅游索道攻略
  • 短信驗證碼平臺 理財 WPS下載

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

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

    国产精品久久久久av电视剧| 美女写真理伦片在线看| 欧美交a欧美精品喷水| 婷婷开心久久网| 视频一区日韩| 精品国产欧美一区二区| 亚洲美女视频在线免费观看| 在线国产网址| 91麻豆国产精品久久| av中文资源在线| 艳妇臀荡乳欲伦亚洲一区| 成人欧美一区二区三区的电影| 午夜精品视频一区| 欧美日韩视频| melody高清在线观看| 亚洲欧美日韩久久| 91麻豆国产自产在线观看亚洲| 日本特黄a级高清免费大片| 国产91在线观看| 一本一道久久a久久| 免费羞羞视频| www久久精品| 日韩一区二区在线| 色爱综合网站| 亚洲日本在线视频观看| 99精品视频精品精品视频| 久久精品视频观看| 一区二区三区精密机械公司| 欧美午夜在线视频| 小h片在线观看| 国产美女视频黄a视频免费| 国产亚洲一区字幕| 欧美日韩色图| 超碰这里只有精品| 激情视频国产| 福利视频网站一区二区三区| 青青一区二区三区| 91超碰碰碰碰久久久久久综合| 欧美mv和日韩mv的网站| 国产精品久久久久精k8| 国产一区二区三区的电影| 国产96在线亚洲| 黄色漫画在线免费看| 日韩一区二区三区在线观看| 国产精品系列在线| 国产高清视频一区| 国产日韩欧美一区二区三区在线观看 | 成人h动漫精品一区二区| 中文字幕中文在线不卡住| 国产中文一区| 好了av在线| 簧片在线观看| 人成福利视频在线观看| **三级三级97片毛片| 日韩视频免费观看高清完整版| 色av综合在线| 福利在线免费| 亚洲免费视频一区二区三区| 蜜桃av在线免费观看| 成人在线免费观看| 中日韩高清电影网| 538在线精品| 亚洲青青久久| 国产一区二区三区四区| 欧美.www| 国产福利视频一区二区三区| 97久久精品人人做人人爽50路| wwwwww.欧美系列| 亚洲伊人伊色伊影伊综合网| 午夜精品福利久久久| 国产精品色哟哟网站| 欧美亚洲综合色| 97在线观视频免费观看| eeuss影院在线播放| 三级在线观看视频| 国产亚洲字幕| 欧美三区不卡| 国产成人啪午夜精品网站男同| 18成人在线视频| 天天av导航| 福利视频在线播放| 色尼玛亚洲综合影院| 亚洲欧洲免费| 国产一区二区三区久久久久久久久 | 成人中文视频| 99久久99久久精品免费观看| 亚洲高清免费视频| 午夜影院韩国伦理在线| 高潮在线视频| 欧美日韩综合| 欧美日本一道本在线视频| 欧美高清xxxxxkkkkk| 欧美日韩激情电影| 日本最新不卡在线| 欧美性猛交xxxx黑人猛交| 四虎在线观看| 日韩免费电影在线观看| 国产激情视频一区二区在线观看| 无吗不卡中文字幕| 韩国中文字幕2020精品| 久久亚州av| 成人免费观看视频| 色婷五月综激情亚洲综合| 国产精选在线| 精品在线免费视频| 免费黄色av| 国产精品丝袜在线播放| 国产精品久久久久久久久久久免费看 | 91网上在线视频| 女人成午夜大片7777在线| 日本全棵写真视频在线观看| 男人天堂久久| 亚洲色图插插| gogogo免费视频观看亚洲一| 91精品国产综合久久福利| 丝袜老师在线| 国产一区二区三区黄视频 | 欧美三级小说| 精品久久久久久中文字幕一区奶水| 欧美xxx.com| 欧美日本二区| 欧美中文字幕亚洲一区二区va在线 | 激情不卡一区二区三区视频在线| 国产精品久久久久久| 精品久久久久久久久国产字幕| aaa在线免费观看| 久久av免费看| 亚洲欧美一区二区三区久本道91 | 亚洲区小说区| 亚洲一区二区精品久久av| 久草资源在线| 免费美女久久99| 制服丝袜一区二区三区| av综合电影网站| 久久久久久久久久久久久女国产乱 | 91网在线看| 免费人成精品欧美精品| 日本免费看黄色| 亚洲视频观看| 国产黄色一级电影| 欧美猛男做受videos| 欧美色网一区二区| 精品福利久久久| 能看av的网址| 亚洲精品护士| 青青久草在线| 久久精品一区| 久草在线资源视频| 麻豆一区二区在线| 亚洲字幕成人中文在线观看| 国产精品久久久一区二区| 日中文字幕在线| 日韩在线观看一区二区| 一级片a一级片| 国产精品538一区二区在线| 欧美videos另类精品| www.亚洲色图.com| 欧美日韩亚洲国产| 亚洲国产精品一区二区www在线| 视频在线日韩| 欧美性受极品xxxx喷水| 在线日本制服中文欧美| 免费av一级电影| 99国产精品久| 豆花视频一区二区| 国产不卡视频| 免费高清在线视频一区·| 欧美日本在线观看| 久久亚洲国产精品尤物| 国产精品18久久久久久久久久久久| 最新理论片影院| gogo大胆日本视频一区| 久久手机免费观看| 在线免费视频一区二区| 日韩欧美另类在线| 1024欧美极品| 先锋成人影院| 尤物网站在线| 精品一性一色一乱农村| 国外男同性恋在线看| 韩国av电影免费观看| 欧美日韩一区二区三区免费看| 99在线精品一区二区三区| 成人激情自拍| aaa大片在线观看| 亚洲黄色性网站| 国产久卡久卡久卡久卡视频精品| 欧美日韩国产免费观看视频| 国产一级网站视频在线| 免费xxxxx网站中文字幕| 欧美在线一二三四区| 成人免费视频免费观看| 亚洲电影影音先锋| 粉嫩一区二区三区在线观看| 亚洲图片欧美| 一不卡在线视频| 国产女主播在线写真| 黄页网站在线观看| 国产精品久久久久久久岛一牛影视 | 久久久加勒比|