日本欧洲视频一区_国模极品一区二区三区_国产熟女一区二区三区五月婷_亚洲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)-大理旅游
    油炸竹蟲
    油炸竹蟲
    酸筍煮魚(雞)
    酸筍煮魚(雞)
    竹筒飯
    竹筒飯
    香茅草烤魚
    香茅草烤魚
    檸檬烤魚
    檸檬烤魚
    昆明西山國家級風景名勝區
    昆明西山國家級風景名勝區
    昆明旅游索道攻略
    昆明旅游索道攻略
  • 短信驗證碼平臺 理財 WPS下載

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

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

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

              9000px;">

                        在线观看免费av网址| 在线视频这里只有精品| 精品人妻少妇嫩草av无码| 国产精品久久久久久久久夜色| 岛国av中文字幕| 欧美亚一区二区三区| 精品丰满少妇一区二区三区| 欧美日韩在线视频免费| 人妻无码一区二区三区免费| 男人网站在线观看| 欧美日韩中文字幕在线观看| 欧美在线a视频| 午夜国产一区二区三区| 网爆门在线观看| 午夜视频在线网站| 亚洲精品久久久久久国| 亚洲女人在线观看| 91福利在线观看视频| www.com在线观看| 国产黄色三级网站| 精品国产999久久久免费| 日日噜噜噜噜人人爽亚洲精品| 天天干天天操天天操| 中文av免费观看| 一道本在线免费视频| 国产福利久久久| 激情五月俺来也| 欧美人妻一区二区| 中文字幕视频观看| 国产精品成人在线视频| 九九热免费在线| 午夜影院免费体验区| 91成人在线免费| 国产这里有精品| 亚洲av成人片无码| 国产乱码一区二区| 天天干天天干天天干| www.日韩一区| 日本视频在线观看免费| a级黄色免费视频| 欧美美女性生活视频| 91香蕉视频免费看| 欧美日韩精品亚洲精品| 91麻豆免费视频网站| 免费一级全黄少妇性色生活片| 亚洲欧美视频二区| 麻豆国产精品一区| 91av免费观看| 日韩在线免费观看av| 超碰免费在线97| 午夜激情在线观看视频| 国产三级自拍视频| 无套内谢丰满少妇中文字幕 | 国产在线观看h| 天天操天天干天天插| 国产精品久久影视| 一区二区三区人妻| 黑人粗进入欧美aaaaa| 中日韩一级黄色片| 久久香蕉精品视频| 99鲁鲁精品一区二区三区| 日韩激情综合网| 国产一级久久久久毛片精品| 中文人妻av久久人妻18| 国产又粗又长视频| 在线观看中文字幕2021| 日本加勒比一区| 国产麻豆免费观看| 在线免费看av的网站| 国产丝袜在线视频| 中文字幕无码人妻少妇免费| 久久国产视频播放| 中文字幕免费在线观看视频| 久久久久亚洲av无码专区体验 | 久久久久99精品成人片三人毛片| 国产在线成人精品午夜| 一二三级黄色片| 特黄特色免费视频| 看黄色一级大片| 97在线观看免费视频| 性高潮久久久久久久久久| 国产又粗又猛又黄| 亚洲美女综合网| 五月天婷婷色综合| 久久视频一区二区三区| 波多野结衣一区二区三区在线| 亚洲va天堂va欧美ⅴa在线| 国产一级aa大片毛片| 91精品国产乱码久久久久| 日本高清久久久| 国产在成人精品线拍偷自揄拍| 中文字幕a在线观看| 人妻中文字幕一区二区三区| 国模无码一区二区三区| 一级特黄性色生活片| 中文字幕一区二区人妻| 亚洲网站在线免费观看| 一起操在线播放| 人妻夜夜爽天天爽| 久久精品国产亚洲av高清色欲| 波多野结衣办公室33分钟| 中文字幕精品无| 熟女人妻在线视频| 欧美成人aaaaⅴ片在线看| 久久久国产精品黄毛片| 国产精品视频免费播放| mm131丰满少妇人体欣赏图| 亚洲免费看av| 亚洲国产精品欧美久久| 中文字幕有码av| 中文字幕免费看| 一区二区三区免费在线| 婷婷色在线视频| 免费看日韩av| 欧美日韩一区二区三区69堂| 久久久久亚洲av成人网人人软件| 国产精品久久久久久无人区| www色aa色aawww| 高清一区二区视频| 97人人爽人人爽人人爽| 亚洲精品国产手机| 一区二区视频免费| 中文字幕求饶的少妇| 亚洲精品www久久久久久| 亚洲天堂网在线视频| 亚洲精品久久久久久久蜜桃 | 色婷婷中文字幕| 少妇av片在线观看| 五月色婷婷综合| 午夜性色福利视频| 亚洲精品免费在线观看视频 | 午夜精品久久久久久久96蜜桃| 天天爱天天做天天爽| 日本中文字幕在线不卡| 五月激情婷婷网| 中文字幕国产在线观看| 中文字幕在线2018| 亚洲熟女一区二区| 亚洲综合久久av一区二区三区| 白白色免费视频| 国产福利免费视频| 国语对白永久免费| 精品熟女一区二区三区| 亚洲精品97久久中文字幕| 国产精品7777| 国产精品男女视频| 亚洲美女综合网| 亚洲精品一区二区三区影院忠贞 | 中文字幕一二三区| 久久国产视频播放| 成人毛片一区二区三区| 一区二区三区四区免费| 美女久久久久久久久| 国产三级午夜理伦三级| 亚洲色成人www永久网站| 四虎国产成人精品免费一女五男| 国产一区二区三区精品在线| 91精品人妻一区二区三区果冻| 少妇精品无码一区二区| 精品视频一区二区在线观看| 国产精品视频一区二区在线观看| 亚欧洲精品在线视频| 亚洲国产精品成人无久久精品| 青娱乐在线视频免费观看| 国产乱色精品成人免费视频| 国产成人在线免费观看视频| 中文字幕+乱码+中文| 免费一区二区三区在线观看| 香蕉视频1024| 国产精品久久久久久久妇| 日韩福利在线视频| 91国内精品视频| 欧美在线 | 亚洲| 99国产精品一区二区三区| 久久精品一级片| 亚洲国产精品久| 久久免费视频99| 亚洲一区二区三区四区五区| 久久久久久久9999| 亚洲熟女一区二区| 人人爽人人爽人人片| av网站在线免费看| 日韩av免费网址| 国产精品久久不卡| 制服丝袜第一页在线观看| 久草网站在线观看| 亚洲一级片av| 日韩一区二区三区四区视频| 国产51自产区| 这里只有久久精品视频| 久久精品久久99| free性中国hd国语露脸| 日本天堂网在线观看| 日韩中文字幕在线观看视频| 国产激情视频在线播放| 伊人久久一区二区三区| 女同性恋一区二区三区| 国产成人免费看一级大黄| 中文字幕精品三级久久久| 久草视频免费播放|