• <button id="ecio8"></button>
  • <li id="ecio8"></li>
    <s id="ecio8"></s>
    <dl id="ecio8"></dl>
    <center id="ecio8"><noscript id="ecio8"></noscript></center>
    • <table id="ecio8"><source id="ecio8"></source></table>
      <bdo id="ecio8"></bdo>
    • <s id="ecio8"></s>

      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)-大理旅游
      油炸竹蟲
      油炸竹蟲
      酸筍煮魚(雞)
      酸筍煮魚(雞)
      竹筒飯
      竹筒飯
      香茅草烤魚
      香茅草烤魚
      檸檬烤魚
      檸檬烤魚
      昆明西山國家級風景名勝區
      昆明西山國家級風景名勝區
      昆明旅游索道攻略
      昆明旅游索道攻略
    • 高仿包包訂製

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

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

      欧美成人免费全部观看天天性色,欧美日韩视频一区三区二区,欧洲美女与动性zozozo,久久久国产99久久国产一
    • <button id="ecio8"></button>
    • <li id="ecio8"></li>
      <s id="ecio8"></s>
      <dl id="ecio8"></dl>
      <center id="ecio8"><noscript id="ecio8"></noscript></center>
      • <table id="ecio8"><source id="ecio8"></source></table>
        <bdo id="ecio8"></bdo>
      • <s id="ecio8"></s>
        主站蜘蛛池模板: 毛片网站免费在线观看| 日本黄网站动漫视频免费| 男人天堂手机在线版| 女地狱肉之壶极限调教2| 午夜成人理论福利片| 一级特黄录像在线观看| 美女张开腿让男人桶国产| 成人精品视频99在线观看免费| 国产1区2区在线观看| 中文字幕不卡一区| 精品国产亚洲一区二区三区 | jizzjizz之xxxx18| 男女爽爽无遮挡午夜动态图| 天天综合在线观看| 亚洲综合色婷婷在线观看| 99久久国产综合精品麻豆| 欧美视频免费在线| 国产精品沙发午睡系列999| 亚洲国产日韩欧美在线as乱码| 娇喘午夜啪啪五分钟娇喘| 最新69成人精品毛片| 国产乱子伦精品无码专区| 中文在线а√天堂| 男人桶爽女人30分钟视频动态图 | 国产特级毛片aaaaaaa高清| 久久综合色之久久综合| 豪妇荡乳1一5白玉兰| 成人国产在线观看高清不卡| 免费播放春色aⅴ视频| 97热久久免费频精品99| 校花被折磨阴部流水| 国产又大又硬又粗| 三男挺进一女爽爽爽视频| 狠狠色综合TV久久久久久| 国产精品天干天干综合网| 久久躁狠狠躁夜夜AV| 老师你的兔子好软水好多的车视频| 好吊色青青青国产综合在线观看| 亚洲深深色噜噜狠狠爱网站| 欧美色图一区二区| 插我一区二区在线观看|