狠狠综合久久久久综合网址-a毛片网站-欧美啊v在线观看-中文字幕久久熟女人妻av免费-无码av一区二区三区不卡-亚洲综合av色婷婷五月蜜臀-夜夜操天天摸-a级在线免费观看-三上悠亚91-国产丰满乱子伦无码专区-视频一区中文字幕-黑人大战欲求不满人妻-精品亚洲国产成人蜜臀av-男人你懂得-97超碰人人爽-五月丁香六月综合缴情在线

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設(shè)計編程
  • 下一篇:CS 161代做、Java/Python程序代寫
  • 無相關(guān)信息
    昆明生活資訊

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

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 kmw.cc Inc. All Rights Reserved. 昆明網(wǎng) 版權(quán)所有
    ICP備06013414號-3 公安備 42010502001045

    狠狠综合久久久久综合网址-a毛片网站-欧美啊v在线观看-中文字幕久久熟女人妻av免费-无码av一区二区三区不卡-亚洲综合av色婷婷五月蜜臀-夜夜操天天摸-a级在线免费观看-三上悠亚91-国产丰满乱子伦无码专区-视频一区中文字幕-黑人大战欲求不满人妻-精品亚洲国产成人蜜臀av-男人你懂得-97超碰人人爽-五月丁香六月综合缴情在线
  • <dl id="akume"></dl>
  • <noscript id="akume"><object id="akume"></object></noscript>
  • <nav id="akume"><dl id="akume"></dl></nav>
  • <rt id="akume"></rt>
    <dl id="akume"><acronym id="akume"></acronym></dl><dl id="akume"><xmp id="akume"></xmp></dl>
    午夜欧美福利视频| 欧美日韩精品在线一区二区| av免费播放网址| 99色这里只有精品| 欧美精品久久久久久久自慰 | 黄色手机在线视频| chinese少妇国语对白| 欧美黄色免费影院| www.com毛片| 免费午夜视频在线观看| 蜜臀视频一区二区三区| 午夜激情在线观看视频| 亚洲成人福利在线| 久久久国产精华液999999 | 成人一级片网站| 国产a级一级片| 爆乳熟妇一区二区三区霸乳| 9久久婷婷国产综合精品性色| 超碰在线97免费| 99热这里只有精品7| 久久综合亚洲精品| 成人免费在线小视频| 日本免费观看网站| 日日噜噜夜夜狠狠久久丁香五月| 欧美极品少妇无套实战| 黄色一级视频片| 99热一区二区| 激情五月婷婷六月| 日韩中文字幕免费在线| 久久久久久久久久毛片| 免费看毛片的网址| 午夜久久福利视频| 日韩精品视频在线观看视频 | 日韩人妻一区二区三区蜜桃视频| 欧美国产综合在线| www.se五月| 草草久久久无码国产专区| 狠狠操狠狠干视频| 黄色免费福利视频| 手机在线免费毛片| 99re在线视频免费观看| 天天爱天天做天天操| 蜜臀久久99精品久久久酒店新书| 91免费视频黄| 簧片在线免费看| 色综合久久久久无码专区| 免费看啪啪网站| 免费一级特黄录像| 欧美日韩二三区| 国产一级片91| 亚洲综合20p| 日韩不卡一二三| 大陆极品少妇内射aaaaa| 亚洲av综合色区| 亚洲第一成肉网| 男人添女人下面免费视频| 欧美aⅴ在线观看| 欧美在线一区视频| 国产精品日韩三级| 亚洲国产精品女人| 欧美激情第四页| 久久久久xxxx| 午夜一级免费视频| 一级黄色在线播放| 亚洲精品永久视频| 五月天视频在线观看| 少妇一级淫免费放| 亚洲天堂网2018| 污污视频在线免费| 国产日本欧美在线| 在线观看17c| 妞干网在线观看视频| 欧美久久久久久久久久久久久| 男人添女人下部视频免费| av动漫在线播放| 欧美精品一区二区三区三州| 男人和女人啪啪网站| 欧美两根一起进3p做受视频| 可以免费在线看黄的网站| 韩国中文字幕av| 日韩a一级欧美一级| 亚洲免费视频播放| 97国产在线播放| 一路向西2在线观看| 最近免费观看高清韩国日本大全| 久久男人资源站| 成人在线观看黄| 一区二区久久精品| 日本wwwcom| av在线网址导航| 国产一二三在线视频| 国产成人av影视| 日本一级淫片演员| 男人的天堂99| 超碰97在线看| 天天操天天爽天天射| 日韩不卡视频一区二区| 国产一区二区视频免费在线观看| 在线播放黄色av| 99精品在线免费视频| 手机在线免费毛片| 成人免费毛片播放| 999一区二区三区| 亚洲综合色在线观看| 日本五级黄色片| 欧美性猛交xxxx乱大交91| 日本a级片免费观看| 小泽玛利亚av在线| 91高清国产视频| 99精品免费在线观看| 免费成人进口网站| 久久精品免费网站| 日本在线xxx| 热久久最新地址| 永久av免费在线观看| 欧美精品成人网| 免费看的黄色大片| 女人被男人躁得好爽免费视频| 一路向西2在线观看| 欧美 国产 小说 另类| 91九色丨porny丨国产jk| 欧美亚洲视频一区| 一区二区免费av| 欧美大尺度做爰床戏| 日本熟妇人妻xxxxx| 成人免费aaa| 男人用嘴添女人下身免费视频| dy888午夜| 艳母动漫在线观看| 久久人妻无码一区二区| 五月天色婷婷综合| a级黄色片网站| 性生活免费观看视频| 久久久成人精品一区二区三区| 九九九九九国产| 在线免费黄色小视频| 99re99热| 欧美久久在线观看| 日韩欧美亚洲天堂| 久久久免费视频网站| 国产无套粉嫩白浆内谢的出处| 99免费视频观看| 五月婷婷六月丁香激情| 亚洲精品mv在线观看| 男人j进女人j| av免费观看大全| 国产激情在线观看视频| 最近中文字幕一区二区| 在线观看免费视频高清游戏推荐| 国产精品自拍视频在线| 51xx午夜影福利| 乱妇乱女熟妇熟女网站| 一级黄色香蕉视频| 中文字幕av导航| www国产精品内射老熟女| 在线观看av日韩| 久久综合亚洲精品| 狠狠热免费视频| 999久久欧美人妻一区二区| 狠狠爱免费视频| 樱空桃在线播放| 日韩精品一区二区三区不卡| 午夜激情影院在线观看| 日本欧美黄色片| www.51色.com| 久久精品.com| 好吊色视频988gao在线观看| 国产又大又硬又粗| 国产女主播av| 手机免费看av网站| 777久久久精品一区二区三区 | 奇米影音第四色| 精品国产一区二区三区无码| 天天操天天摸天天爽| 精品国偷自产一区二区三区| 一区二区三区 日韩| www在线观看免费| 成年人三级视频| 亚洲另类第一页| 国产欧美高清在线| 国产免费黄色小视频| 日韩av福利在线观看| 大香煮伊手机一区| 中文字幕无码精品亚洲35| 欧美少妇在线观看| 91高清国产视频| 欧美精品aaaa| 日韩a在线播放| 成人毛片视频网站| 日韩欧美国产综合在线| 男女爱爱视频网站| 一区中文字幕在线观看| 天天操精品视频| 亚洲一区二区福利视频| 中文av一区二区三区| 在线观看日本一区二区| 福利片一区二区三区| www.色就是色| 中文字幕国产免费| 亚洲精品手机在线观看|