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

    www.久久久久久久久久久| 日本免费成人网| 欧美日韩一道本| 粉嫩虎白女毛片人体| 国产av熟女一区二区三区| 黄色一级片免费播放| 污视频网站观看| 久久精品网站视频| 亚洲色成人一区二区三区小说| 丁香色欲久久久久久综合网| 欧美a级黄色大片| 91免费视频黄| 国产福利片一区二区| 久热精品在线播放| 午夜宅男在线视频| 中文字幕一区二区三区四区在线视频| 免费成人午夜视频| 91好吊色国产欧美日韩在线| 妞干网在线视频观看| 国产高清av在线播放| 日韩av新片网| 亚洲熟妇国产熟妇肥婆| av免费观看国产| 波多野结衣乳巨码无在线| 波多野结衣之无限发射| 两根大肉大捧一进一出好爽视频| 男女激情无遮挡| 中文字幕无码不卡免费视频| 免费国产成人av| 美女少妇一区二区| 色乱码一区二区三区在线| 伊人成人222| 中文字幕在线视频一区二区| 在线观看18视频网站| av在线免费观看国产| 妞干网在线视频观看| 国产中文字幕免费观看| 成人一级片网站| www.久久久精品| 成人短视频在线看| 隔壁人妻偷人bd中字| 亚洲国产精品久久久久婷蜜芽| 免费国产成人av| 国产aⅴ爽av久久久久| 国产av第一区| 18岁网站在线观看| 亚洲视频在线a| 肉色超薄丝袜脚交| 黄色激情在线视频| 欧美视频第三页| 亚洲免费999| 日本免费a视频| 日韩中文字幕免费在线| 中文字幕一区二区在线观看视频| 91国在线高清视频| 91精品91久久久中77777老牛| 人人干人人干人人| 日本精品福利视频| 日韩中文字幕免费在线| 中文字幕黄色大片| 国产一区二区网| 手机免费看av网站| 无码 制服 丝袜 国产 另类| 日韩av手机版| 国产成人在线小视频| 国产精品入口免费软件| 国产女人18毛片| 日韩无套无码精品| 妞干网这里只有精品| 日本精品一区二区三区四区| 日本黄色a视频| 欧美黄色一级片视频| 看一级黄色录像| 亚洲成人福利在线观看| wwwwww欧美| av亚洲天堂网| 日本三级免费观看| 久久久久久久久影视| 亚洲性生活网站| 人体内射精一区二区三区| 在线观看日本一区二区| 精品久久一二三| 婷婷视频在线播放| 人人干人人视频| 18禁免费观看网站| 中文字幕乱码免费| 男女污污的视频| 91av资源网| 天堂8在线天堂资源bt| 国产乱码一区二区三区四区| 国产日产欧美视频| 国产在线视频综合| 深爱五月综合网| 中文字幕视频在线免费观看| 九一国产精品视频| 青青草免费在线视频观看| 牛夜精品久久久久久久| 乱人伦xxxx国语对白| 国产一级不卡视频| 一级片免费在线观看视频| 999在线免费视频| 国产精品免费入口| 性高湖久久久久久久久aaaaa| 欧美性视频在线播放| 香港日本韩国三级网站| 国产aaa一级片| 久久综合色视频| 黄色一级视频在线播放| 亚洲精品国产suv一区88| 日本特黄在线观看| 欧美激情国内自拍| 97超碰人人爽| 久久国产精品国产精品| 在线免费视频a| 能在线观看的av网站| 无码人妻h动漫| 久久久久人妻精品一区三寸| 日本日本19xxxⅹhd乱影响| 欧美又粗又长又爽做受| 免费在线看黄色片| 国产精品69久久久| 日韩a级在线观看| 亚洲人成无码网站久久99热国产| 人妻互换免费中文字幕| 91视频 - 88av| 高清无码一区二区在线观看吞精| 艳母动漫在线观看| 三级在线免费观看| 50度灰在线观看| 高清无码一区二区在线观看吞精| 91精品国产吴梦梦| 50度灰在线观看| 日韩极品视频在线观看| 亚洲熟妇无码一区二区三区导航| 免费拍拍拍网站| 欧美色图另类小说| 成年人网站大全| jizzzz日本| 日日噜噜噜夜夜爽爽| 黄色一级片av| 国产婷婷一区二区三区| 青青艹视频在线| 黄色成人免费看| www,av在线| 国产传媒久久久| 毛片在线播放视频| 日韩视频第二页| 91小视频网站| 99精品视频网站| 成人黄色大片网站| 亚洲人成色77777| 国产亚洲视频一区| 97在线免费视频观看| 国产97在线 | 亚洲| 别急慢慢来1978如如2| 国产又黄又猛的视频| ijzzijzzij亚洲大全| 男女私大尺度视频| 北条麻妃在线视频| 色婷婷综合在线观看| 超碰成人免费在线| 国产熟人av一二三区| 青娱乐精品在线| 国产69精品久久久久久久| 亚洲精品一二三四五区| 免费观看黄色的网站| 少妇av一区二区三区无码| 一区二区三区视频在线观看免费| 亚洲国产欧美91| 日日鲁鲁鲁夜夜爽爽狠狠视频97| 日本肉体xxxx裸体xxx免费| 久久国产精品免费观看| 日日摸日日碰夜夜爽av| 男人午夜视频在线观看| 91九色丨porny丨国产jk| 伊人影院综合在线| 97视频久久久| 国产精品自在自线| 国产中文字幕二区| 日本美女视频一区| 日韩精品在线视频免费观看| 亚洲一级片网站| 免费看国产一级片| 午夜免费一级片| 日韩欧美一区二| 日韩av.com| 丰满少妇被猛烈进入高清播放| 97超碰人人看| 福利在线一区二区三区| 美女av免费观看| 国产又黄又猛又粗| 97视频在线免费| 一级 黄 色 片一| 亚洲 中文字幕 日韩 无码| 大胆欧美熟妇xx| 免费黄频在线观看| 中文字幕第21页| 鲁一鲁一鲁一鲁一色| 四虎免费在线观看视频| 少妇黄色一级片|