久久久久久精品无码人妻_青春草无码精品视频在线观_无码精品国产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

    久久久久久精品无码人妻_青春草无码精品视频在线观_无码精品国产VA在线观看_国产色无码专区在线观看

    欧美极品欧美精品欧美| 国产精品涩涩涩视频网站| 免费涩涩18网站入口| 人人干视频在线| 精品国偷自产一区二区三区| 91蝌蚪视频在线| 国产福利精品一区二区三区| 国产精品免费看久久久无码| 亚洲va综合va国产va中文| www.成人黄色| 蜜桃网站在线观看| 污版视频在线观看| 自拍一级黄色片| 动漫av免费观看| 国产资源在线视频| 久久久久久久久久久久久国产| 无码人妻精品一区二区蜜桃百度| 手机在线成人免费视频| 久草青青在线观看| the porn av| 亚洲熟妇国产熟妇肥婆| 日本大胆人体视频| 九九九久久久久久久| 亚洲性生活网站| 五月天婷婷在线观看视频| 日韩毛片在线免费看| 黄色aaaaaa| 国产精品久久a| 黄色三级视频在线| 国产精品沙发午睡系列| 777一区二区| 手机视频在线观看| 黄色国产小视频| 日本老熟妇毛茸茸| 精品中文字幕av| 大肉大捧一进一出好爽视频| 九九爱精品视频| 777av视频| 99九九精品视频| 一级黄色片国产| 91在线第一页| 一二三级黄色片| 中文字幕资源在线观看| 久久国产这里只有精品| 亚洲欧美自偷自拍另类| 色噜噜狠狠永久免费| 中文字幕视频在线免费观看| 免费日韩视频在线观看| www国产黄色| 国产精品97在线| 日韩视频在线免费看| 亚洲人成色77777| 国产精品69页| 99热这里只有精品在线播放| 免费看涩涩视频| 一本一道久久a久久综合蜜桃| 四季av一区二区三区| 亚洲三级在线观看视频| 伊人五月天婷婷| 欧美在线观看视频免费| 自拍偷拍21p| 日韩av自拍偷拍| 成人在线观看毛片| 国产成人永久免费视频| 国产av天堂无码一区二区三区| 日韩av在线播放不卡| 免费无码av片在线观看| 少妇性l交大片| 国产性生活一级片| 日韩中文字幕亚洲精品欧美| 国产精品久久久久9999爆乳| 黄色片免费网址| 特级西西444| 国产成人a亚洲精v品无码| 亚洲国产精品毛片av不卡在线| 亚洲精品视频导航| 色中文字幕在线观看| 国产一二三区av| 小说区视频区图片区| 成人一级生活片| 国产成人手机视频| 欧美 日韩 国产 在线观看 | 精品无码一区二区三区在线| 99视频免费播放| 日本久久高清视频| 伊人成人免费视频| 日韩av在线播放不卡| 一区二区三区 日韩| 五月天激情图片| 激情婷婷综合网| 国产日韩视频在线播放| 僵尸世界大战2 在线播放| 国产区二区三区| 欧美在线观看黄| 人人干人人视频| 国产精品免费看久久久无码| 成人亚洲视频在线观看| 国产911在线观看| 午夜dv内射一区二区| 免费极品av一视觉盛宴| 成年人视频在线免费| 欧美做受777cos| 男女爽爽爽视频| 99久久久精品视频| 高清一区在线观看| 欧美视频在线观看视频| 91高清国产视频| 国产一区二区网| 国产高潮呻吟久久久| 超碰影院在线观看| 草草视频在线免费观看| 污污视频网站在线| 免费日韩中文字幕| 欧美a级免费视频| 色乱码一区二区三区在线| 日本韩国欧美在线观看| 熟妇熟女乱妇乱女网站| 色诱视频在线观看| 日本人体一区二区| 日本一二三四区视频| 狠狠操精品视频| 妺妺窝人体色777777| 波多野结衣三级在线| 亚洲老女人av| 国产偷人视频免费| 日日摸日日碰夜夜爽无码| 99精品视频网站| 久久久精品高清| 欧美少妇性生活视频| 久久成人福利视频| 一级黄色片播放| 加勒比av中文字幕| 日本老熟妇毛茸茸| 国产精品欧美激情在线观看| 国产一区二区四区| 91成人在线视频观看| 日本77777| 中文字幕免费高清在线| 爱豆国产剧免费观看大全剧苏畅 | 18黄暴禁片在线观看| 伊人精品视频在线观看| 免费在线观看的毛片| 37pao成人国产永久免费视频| 国产va亚洲va在线va| 激情五月六月婷婷| 日韩video| 潘金莲一级淫片aaaaa免费看| 久久精品视频在线观看免费| 九九热精品在线播放| 五月婷婷丁香综合网| 少妇人妻互换不带套| 女人扒开屁股爽桶30分钟| 国产免费毛卡片| 人妻少妇被粗大爽9797pw| 岳毛多又紧做起爽| 青青草原成人网| 欧美黄色免费影院| 国产a视频免费观看| mm1313亚洲国产精品无码试看| 国产三级三级三级看三级| 国产免费人做人爱午夜视频| 少妇人妻互换不带套| 福利在线一区二区三区| 久久这里只精品| 伊人成人222| 熟女熟妇伦久久影院毛片一区二区| a级黄色片网站| 800av在线免费观看| 青青草精品视频在线| 黄色片视频在线免费观看| 成人黄色一区二区| 久热精品在线播放| 久久av秘一区二区三区| 特级西西444| www.av毛片| 激情婷婷综合网| 亚洲三级在线观看视频| 超碰免费在线公开| 国产一二三在线视频| 欧美精品一区免费| 亚洲天堂网一区| 四虎免费在线观看视频| 欧美一级免费播放| 成人观看免费完整观看| 少妇一级淫免费播放| 自拍一级黄色片| 日本a视频在线观看| 日韩精品免费播放| 超碰91在线播放| 阿v天堂2018| 亚洲天堂av线| 99精品一区二区三区的区别| 蜜桃传媒一区二区三区| 丰满少妇在线观看| 老司机午夜网站| 黄色a级片免费| 中文字幕在线视频一区二区三区| 无码人妻精品一区二区蜜桃网站| 免费男同深夜夜行网站| 亚洲一区二区三区四区精品|