精品深夜AV无码一区二区_伊人久久无码中文字幕_午夜无码伦费影视在线观看_伊人久久无码精品中文字幕

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ū)
    昆明旅游索道攻略
    昆明旅游索道攻略
  • 短信驗證碼平臺 理財 WPS下載

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 kmw.cc Inc. All Rights Reserved. 昆明網(wǎng) 版權(quán)所有
    ICP備06013414號-3 公安備 42010502001045

    精品深夜AV无码一区二区_伊人久久无码中文字幕_午夜无码伦费影视在线观看_伊人久久无码精品中文字幕
    <samp id="e4iaa"><tbody id="e4iaa"></tbody></samp>
    <ul id="e4iaa"></ul>
    <blockquote id="e4iaa"><tfoot id="e4iaa"></tfoot></blockquote>
    • <samp id="e4iaa"><tbody id="e4iaa"></tbody></samp>
      <ul id="e4iaa"></ul>
      <samp id="e4iaa"><tbody id="e4iaa"></tbody></samp><ul id="e4iaa"></ul>
      <ul id="e4iaa"></ul>
      <th id="e4iaa"><menu id="e4iaa"></menu></th>
      国产手机av在线| 日本一级二级视频| 福利一区二区三区四区| 伊人色在线视频| 久久无码精品丰满人妻| 高潮一区二区三区乱码| 亚洲成人av免费观看| 久久久无码人妻精品一区| 91午夜视频在线观看| 中文乱码人妻一区二区三区视频| 欧美精品一二三四区| 久久久www成人免费毛片| 精品久久久久成人码免费动漫| 国产高清视频网站| 国产精品jizz| 国产人妻精品一区二区三区不卡| www.99re6| 亚洲精品国产精| 亚洲av熟女国产一区二区性色| 少妇欧美激情一区二区三区| 色欲AV无码精品一区二区久久| 蜜桃91麻豆精品一二三区| 韩国视频一区二区三区| 国产又粗又猛视频免费| 精品国产999久久久免费| 国产午夜在线一区二区三区| 国产在线观看99| 狠狠操狠狠干视频| 久久综合在线观看| 日韩一级在线播放| 亚洲 美腿 欧美 偷拍| 亚洲av片不卡无码久久| 青娱乐国产视频| 日韩精品在线免费视频| 日韩视频中文字幕在线观看 | 老女人性生活视频| 久久久久xxxx| 深爱激情五月婷婷| 一级黄色大片免费| 国产伦精品一区二区三区免.费| 国产传媒在线看| 蜜桃色一区二区三区| 无码人妻精品一区二区三区蜜桃91| 中文天堂在线视频| h色网站在线观看| 波多野结衣啪啪| 久久婷婷五月综合| 中文字幕亚洲欧洲| 国产精品suv一区二区88| 久久久久久久久久成人| 性久久久久久久久久久| 91性高潮久久久久久久| 国产一级中文字幕| 色婷婷一区二区三区在线观看| 亚洲人人夜夜澡人人爽| 久久av高潮av无码av喷吹| 亚洲第一香蕉网| 激情五月婷婷小说| 亚洲黄色在线免费观看| 久久久精品人妻无码专区| 欧美视频一二区| av无码精品一区二区三区宅噜噜| 免费看黄色aaaaaa 片| 一二三区免费视频| 秋霞欧美一区二区三区视频免费| 亚洲综合第一区| 欧美 日韩 国产 成人 在线| 91成人在线免费| 日本美女久久久| 国产suv精品一区二区68| 日韩欧美理论片| 国产微拍精品一区| 中文字幕男人天堂| 蜜臀一区二区三区精品免费视频 | aaa国产视频| 欧美69精品久久久久久不卡| aaa人片在线| 中文字幕天堂网| 日韩av在线播| 九九热国产视频| 国产精品视频一区二区在线观看| 在线观看国产亚洲| 欧美风情第一页| 国产一二三四五区| aaa一区二区| 中文字幕人妻一区二区三区| 蜜桃av乱码一区二区三区| 国产伦子伦对白视频| 中文字幕 国产| 日本中文字幕精品| 久久精品偷拍视频| 国产探花在线视频| 波多野结衣国产| 99精品视频在线播放免费| 微拍福利一区二区| 日本中文字幕网| 久久久无码一区二区三区| 国产一级淫片a| 国产麻豆a毛片| 国产区在线观看视频| 国产精品理论在线| 国产色视频在线| 精品成人免费视频| 激情综合丁香五月| 久久精品欧美一区二区| 久久久久成人精品无码| 国产在线a视频| 国产手机精品视频| 国产欧美一区二| 精品国产欧美日韩不卡在线观看| 国产性猛交96| 久久久久亚洲av无码网站| 久久久久久久伊人| 日本精品一二三区| 天天综合网入口| 亚洲三区在线播放| www.日本高清| 国产成人无码www免费视频播放| 亚洲精品乱码久久久久久不卡| 亚洲精品中文字幕乱码无线| 亚洲精品无码久久久久| 在线亚洲欧美日韩| 99久久99久久精品国产| 国产女主播喷水视频在线观看| 国精产品一区一区三区免费视频 | 精品国产免费久久久久久婷婷| 精品二区在线观看| 欧美日韩综合一区二区| 午夜天堂在线视频| 夜夜爽久久精品91| 97人人模人人爽人人澡| 成人小视频在线播放| 久久久老熟女一区二区三区91| 日韩精品一区二区三| 亚洲乱码国产乱码精品| 国产婷婷色一区二区在线观看| 蜜桃视频久久一区免费观看入口| 日本一区二区网站| 中文字幕理论片| 国产婷婷在线观看| 久久亚洲成人av| 一区二区三区免费在线观看视频| 91麻豆一区二区| 国产免费一区二区三区最新6| 九九九视频在线观看| 日本天堂在线视频| 中文字幕在线观看视频www| 国产福利精品一区二区三区| 久久久久久蜜桃| 亚洲区 欧美区| 久久久久久久久久影院| 亚洲图片视频小说| 美女100%露胸无遮挡| 亚洲精品久久久中文字幕| 国产一二三四五区| 一区二区三区免费在线| 狠狠人妻久久久久久综合蜜桃| 亚洲av网址在线| 国产在线视频99| 中文字幕精品三级久久久| 国产日韩欧美久久| 一区二区黄色片| 国产在线观看你懂的| 伊人国产在线视频| 精品成人av一区二区在线播放| 中文乱码人妻一区二区三区视频| 黑人粗进入欧美aaaaa| 最新国产精品自拍| 欧美日韩精品区| 国产精品第七页| 亚洲精品一级片| 天堂在线观看av| 久久久久久久久97| 国产农村妇女毛片精品久久| 亚洲精品国产熟女久久久| 麻豆成人免费视频| www国产视频| 亚洲精品在线视频播放| 久久亚洲国产成人精品性色| 99国产精品一区二区三区| 日韩一级理论片| 精品无码人妻少妇久久久久久| 26uuu国产| 中文字幕乱码人妻二区三区| 日本少妇激三级做爰在线| 极品粉嫩小仙女高潮喷水久久| a网站在线观看| 亚洲一区二区三区黄色| 午夜精品久久久久久久第一页按摩| 精品无码人妻一区二区三区品| www.综合色| 69精品久久久| 亚洲精品视频在线观看免费视频| 日韩 欧美 精品| 欧美亚洲日本在线| 欧美熟妇另类久久久久久不卡| 国产一伦一伦一伦| 国产亚洲精品久久久久久无几年桃| 国产69视频在线观看| 丰满少妇一区二区三区专区|