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

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

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

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

              欧美性猛交99久久久久99按摩| 亚洲中字黄色| 国产喷白浆一区二区三区| 久久女同精品一区二区| 在线亚洲激情| 在线日韩视频| 国产麻豆9l精品三级站| 欧美日韩精品免费在线观看视频| 久久精品视频在线播放| 在线视频免费在线观看一区二区| 伊人狠狠色丁香综合尤物| 国产精品久久久久久户外露出| 久久亚洲精品伦理| 欧美一区二区三区男人的天堂 | 国产精品久久久久久亚洲毛片| 久久一本综合频道| 欧美一区免费| 亚洲一区在线免费观看| 9人人澡人人爽人人精品| 亚洲成色777777女色窝| 激情91久久| 国内一区二区在线视频观看| 国产午夜精品美女毛片视频| 国产精品日韩一区二区三区| 欧美人成在线| 欧美日韩成人在线观看| 六月丁香综合| 久久久午夜电影| 久久久久久久一区二区三区| 欧美一乱一性一交一视频| 亚洲欧美精品在线观看| 亚洲永久免费视频| 亚洲在线成人精品| 中文在线一区| 亚洲女同精品视频| 亚欧成人精品| 久久网站免费| 欧美高清不卡| 欧美午夜精品理论片a级按摩| 欧美日精品一区视频| 国产精品久久| 国产自产女人91一区在线观看| 国产在线拍偷自揄拍精品| 黄色av一区| 亚洲精品国产精品国自产观看浪潮 | 久久久蜜桃一区二区人| 久久久在线视频| 欧美激情一区二区三级高清视频| 欧美日韩理论| 国产在线精品一区二区夜色| 亚洲国产精品成人va在线观看| 亚洲欧洲日本mm| 亚洲一区视频在线| 另类图片国产| 国产精品美女久久久久aⅴ国产馆| 国产婷婷色综合av蜜臀av| 亚洲国产日韩美| 亚洲色图制服丝袜| 久久野战av| 国产精品久久久一区麻豆最新章节| 国产区精品在线观看| 亚洲高清中文字幕| 亚洲在线播放| 美腿丝袜亚洲色图| 国产精品无码专区在线观看| 亚洲国产高清一区二区三区| 亚洲视频电影在线| 香港久久久电影| 久久久欧美一区二区| 欧美日韩成人综合| 国产伦精品免费视频| 狠狠色2019综合网| 亚洲欧洲精品一区二区三区不卡 | 欧美一区激情视频在线观看| 久久国产精品电影| 欧美黄色影院| 国产欧美日韩在线观看| 亚洲国产精品一区二区第四页av| 激情综合中文娱乐网| 亚洲激情成人网| 欧美亚洲一级| 欧美精品免费在线观看| 国产精品久久久久免费a∨| 激情国产一区二区| 亚洲一级特黄| 欧美精品福利| 韩国免费一区| 亚洲欧美日韩另类精品一区二区三区| 欧美大片免费观看| 欧美极品在线视频| 国产精品美女主播| 亚洲精品一区在线观看| 久久精品国产一区二区三区免费看| 欧美韩日视频| 影院欧美亚洲| 欧美伊久线香蕉线新在线| 欧美日韩一区综合| 91久久夜色精品国产九色| 亚洲午夜一区二区三区| 欧美激情 亚洲a∨综合| 在线不卡视频| 久久精品av麻豆的观看方式 | 欧美日韩播放| 国产亚洲人成a一在线v站| 在线视频欧美日韩精品| 欧美电影免费| 亚洲国产另类精品专区| 久久人人爽人人爽爽久久| 国产伦精品一区二区三区照片91| 艳妇臀荡乳欲伦亚洲一区| 久久综合伊人77777麻豆| 国语自产在线不卡| 亚洲欧美日韩在线高清直播| 国产欧美日韩综合一区在线播放| 亚洲综合999| 国产精品久久7| 亚洲欧美大片| 国产一区二区三区久久| 午夜久久电影网| 欧美日韩美女一区二区| 午夜在线一区二区| 国内外成人免费激情在线视频| 欧美一级在线播放| 很黄很黄激情成人| 美女主播精品视频一二三四| 亚洲激情av在线| 久久久精品国产免费观看同学| 亚洲电影网站| 欧美gay视频激情| 亚洲毛片av在线| 欧美日韩视频在线| 亚洲欧美中文另类| 国内视频一区| 久久嫩草精品久久久精品一| 亚洲精品乱码久久久久久蜜桃91| 欧美华人在线视频| 亚洲欧美日韩一区二区| 国产亚洲精品aa午夜观看| 美女视频一区免费观看| 亚洲视频网站在线观看| 欧美日韩在线一区二区| 久久精品综合网| 最新国产乱人伦偷精品免费网站 | 久久精品国产成人| 激情欧美日韩| 国产日韩欧美在线视频观看| 久久综合久色欧美综合狠狠| 亚洲黄色免费网站| 国产精品久久久久久久午夜 | 亚洲风情亚aⅴ在线发布| 美女精品国产| 亚洲午夜久久久久久久久电影网| 国产欧美日韩一区| 欧美精品激情在线| 新片速递亚洲合集欧美合集| 亚洲国产成人91精品| 国产精品视频xxx| 欧美成人午夜激情在线| 午夜视频一区在线观看| 黄色av一区| 欧美午夜一区二区| 欧美大片一区二区| 久久久久久自在自线| 午夜精品久久久久影视| **欧美日韩vr在线| 国产亚洲欧美一级| 欧美性生交xxxxx久久久| 久久婷婷蜜乳一本欲蜜臀| 亚洲综合首页| 亚洲精品视频免费| 国产一区二区精品| 国产日韩精品一区观看| 欧美日韩中文精品| 欧美激情综合色综合啪啪| 浪潮色综合久久天堂| 欧美在线免费视频| 亚洲欧美另类在线| 亚洲欧美乱综合| 亚洲天堂男人| 一区二区精品| 99国产精品国产精品毛片| 亚洲日本在线观看| 亚洲国产网站| 一区二区三区欧美在线| 日韩视频在线免费观看| 亚洲精品欧美日韩专区| 亚洲乱亚洲高清| 99www免费人成精品| 亚洲高清久久网| 亚洲午夜精品一区二区| 一本久久青青| 亚洲欧美伊人| 欧美在线3区| 久久这里只有| 欧美日韩一区在线播放| 欧美亚洲不卡| 国产日本欧美一区二区| 国产综合18久久久久久| 亚洲电影成人| 亚洲欧美日韩国产成人精品影院|