狠狠综合久久久久综合网址-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>
    亚洲精品成人在线播放| 国产精品久久a| 超碰在线超碰在线| 五月激情五月婷婷| 久久精品免费网站| 日本精品免费在线观看| 久久综合色视频| 成人在线看视频| 奇米影音第四色| 免费看黄色一级大片| 亚洲欧美日韩一级| 手机免费看av网站| 亚洲热在线视频| 无码人妻精品一区二区蜜桃网站| 不用播放器的免费av| 亚洲视频一二三四| 警花观音坐莲激情销魂小说| av在线网站免费观看| 国产av不卡一区二区| 大陆av在线播放| 99久久国产宗和精品1上映| 欧美日韩亚洲自拍| 成人免费看片视频在线观看| 亚洲人精品午夜射精日韩| 欧美 国产 综合| 一本岛在线视频| 91大学生片黄在线观看| aa视频在线播放| 国产情侣av自拍| 国产高清精品软男同| 男人c女人视频| 亚洲黄色小视频在线观看| 在线视频日韩欧美| 国内自拍在线观看| 视频区 图片区 小说区| 国产乱子伦农村叉叉叉| 在线观看免费的av| 无码粉嫩虎白一线天在线观看| 国产极品粉嫩福利姬萌白酱| xxww在线观看| 国产成人无码a区在线观看视频| 99视频在线视频| www.日本在线视频| 想看黄色一级片| 91黄色小网站| 亚洲啊啊啊啊啊| 久久婷婷综合色| 免费 成 人 黄 色| 中文字幕乱码免费| 手机av在线免费| 久久黄色免费看| 国产乱淫av片杨贵妃| 天天影视色综合| 一本久道综合色婷婷五月| 欧美一级黄色录像片| 久久国产激情视频| 精品久久久久久久无码| 欧美精品久久久久久久免费| 国产日本欧美在线| 交换做爰国语对白| 成人亚洲免费视频| 亚洲福利精品视频| 日本成人中文字幕在线| 欧美午夜小视频| www.射射射| 水蜜桃色314在线观看| 久草视频这里只有精品| 欧美视频在线第一页| 女同性恋一区二区| 国产精品久久国产| 人妻无码久久一区二区三区免费| 黄色网络在线观看| 99热这里只有精品免费| 2021国产视频| 久久久天堂国产精品| 久久av高潮av| 97国产在线播放| 久久久久久久久久久福利| 日韩欧美xxxx| 国产精品一区二区小说| 中文字幕12页| 97超碰在线人人| 国产一级爱c视频| 日本精品久久久久久久久久| 久久国产精品免费观看| 精品少妇在线视频| 黑森林福利视频导航| 99热这里只有精品在线播放| 污污的视频免费观看| 喜爱夜蒲2在线| 黄色片久久久久| www.com污| 妞干网视频在线观看| 男人日女人bb视频| 不用播放器的免费av| 日韩免费在线观看av| 国产黄色特级片| 老汉色影院首页| 成年人免费在线播放| 成人综合久久网| 国产精品久久久久久久乖乖| 无遮挡又爽又刺激的视频 | 精品久久一二三| 992kp快乐看片永久免费网址| 亚洲黄色片免费看| 免费成人午夜视频| 五月激情五月婷婷| 日本福利视频在线| 青青草综合视频| 毛片av免费在线观看| 中国一级大黄大黄大色毛片| 少妇高潮喷水久久久久久久久久| 亚洲欧美日韩网站| 成年人免费在线播放| 欧美美女黄色网| 一级淫片在线观看| 好男人www社区| 亚洲 欧美 综合 另类 中字| 午夜国产福利在线观看| 男人用嘴添女人下身免费视频| 亚洲怡红院在线| 91n.com在线观看| 国产一区二区网| 一级黄色片播放| 波多野结衣激情| 欧美韩国日本在线| 樱花草www在线| 色婷婷成人在线| 国产视频手机在线播放| 欧美视频在线免费播放| www.亚洲成人网| 日韩精品在线观看av| 国产99久久九九精品无码| av磁力番号网| 蜜桃网站在线观看| 肉大捧一出免费观看网站在线播放| 污片在线免费看| 亚洲最大综合网| 久久久久久久高清| 国产福利片一区二区| 国产一级片中文字幕| 99热这里只有精品7| 午夜探花在线观看| 日韩中文在线字幕| 欧美成人精品免费| 日韩av新片网| 国产成人精品视频ⅴa片软件竹菊| 成人久久久久久久久| 色www免费视频| 中文字幕色呦呦| 亚洲制服中文字幕| 亚洲一区二区三区四区精品| 欧美日韩久久婷婷| 久久久久久久香蕉| 欧美精品久久久久久久免费| 黑人糟蹋人妻hd中文字幕| 国内外成人激情视频| 岛国av在线免费| 少妇熟女一区二区| 2018国产在线| 在线观看av网页| 国产精品自拍合集| 久久9精品区-无套内射无码| 一路向西2在线观看| 日本人妻伦在线中文字幕| av免费观看网| 成 人 黄 色 小说网站 s色| 成人手机在线播放| 少妇人妻互换不带套| 2021国产视频| 男人亚洲天堂网| 亚洲色图都市激情| 韩国中文字幕av| 中文精品无码中文字幕无码专区| 91九色在线观看视频| 国产精品12p| 一区二区在线播放视频| 国产青草视频在线观看| 在线观看高清免费视频| 日韩美女爱爱视频| 亚洲高清av一区二区三区| 国产精品亚洲αv天堂无码| 国产av第一区| 亚洲成人手机在线观看| 日韩第一页在线观看| 国产淫片免费看| 欧美日韩中文字幕在线播放| 日本黄色福利视频| 日本www高清视频| av7777777| 免费一级特黄毛片| 欧美大片免费播放| 国产999免费视频| 国产精品自在自线| 国产又黄又猛的视频| 日日噜噜夜夜狠狠| 99sesese| 日本不卡一区二区在线观看| 在线观看高清免费视频| 天天色综合天天色|