CS 1501代做、代寫Python/Java程序設(shè)計(jì)

時間:2024-04-08  來源:  作者: 我要糾錯



Support for Assignment 4
CS 1501
Sherif KhattabGeneral Hints
• You can get the number of vertices using ag.getAirports().size(), whereby 
ag is an AirlineGraph object
• Iterate over airports using for(String airport: ag.getAirports()){ … }
• You can get a unique integer for each airport in the graph using the 
ag.getAirportNo() method
• You can retrieve the set of neighbors of an airport using 
ag.adj(airportName)
• To iterate over the set of neighbors: for(Route r: ag.adj(airportName)){ … }
• You can retrieve the name of a neighboring airport using r.destination
• You may use HashSet to instantiate Set objectsfewestStops
• Use BFS
• check the pseudo-code in lecture notes
• Shortest path Source -> transit -> destination can be found by
• shortest path source  transit
• shortest path transit  destination
• concatenate the two shortest paths
• Be careful not to add transit twice to the concatenated pathConnected Components
• Use BFS
• You can find the pseudo-code in the lecture notesallTrips
• Use backtracking and pruning
• Define a recursive helper method: solve(current decision, current solution)
• current decision  current vertex (int or String) • current solution
• Set<ArrayList<Route>> of trips found so far
• current path: ArrayList<Route>
• total price so far of current path
• number of stops so far of current path
• destination, budget and max number of stops for comparison
• Inside the recursive helper method:
• if current vertex is the destination  add current path to the solution set and return
• iterate over all possibilities (unmarked neighbors)
• check if you can add the neighbor to the current path (total price won’t exceed budget and total number of stops won’t exceed maximum stops)
• if so, mark neighbor, update current path, its price, and its number of stops. 
• make a recursive call on the neighbor
• undo changes to current path, price, and number of stops and unmark neighbor
• mark start airport before calling solve the first timeallRoundTrips
• Use backtracking and pruning
• Define a recursive helper method: solve(current decision, current solution)
• current decision  current vertex (int or String) • current solution
• Set<ArrayList<Route>> of trips found so far
• current path: ArrayList<Route>
• total price so far of current path
• number of stops so far of current path
• budget and max number of stops for comparison
• Inside the recursive helper method:
• if current vertex is the source and stops so far > 0  add current path to the solution set and return
• iterate over all possibilities (unmarked neighbors)
• check if you can add the neighbor to the current path (total price won’t exceed budget and total number of stops won’t exceed maximum stops)
• if so, mark neighbor, update current path, its price, and its number of stops. 
• make a recursive call on the neighbor
• undo changes to current path, price, and number of stops and unmark neighbor
• Don’t mark start airport before calling solve the first time

請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp














 

標(biāo)簽:

掃一掃在手機(jī)打開當(dāng)前頁
  • 上一篇:代寫CSCI 2122、C++編程設(shè)計(jì)代做
  • 下一篇:代寫EECS 493、代做Java設(shè)計(jì)編程
  • 無相關(guān)信息
    昆明生活資訊

    昆明圖文信息
    蝴蝶泉(4A)-大理旅游
    蝴蝶泉(4A)-大理旅游
    油炸竹蟲
    油炸竹蟲
    酸筍煮魚(雞)
    酸筍煮魚(雞)
    竹筒飯
    竹筒飯
    香茅草烤魚
    香茅草烤魚
    檸檬烤魚
    檸檬烤魚
    昆明西山國家級風(fēng)景名勝區(qū)
    昆明西山國家級風(fēng)景名勝區(qū)
    昆明旅游索道攻略
    昆明旅游索道攻略
  • 高仿包包訂製

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

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

    亚洲精品无码永久在线观看你懂的 | 亚洲一区精品无码| 亚洲av无码一区二区三区人妖| 亚洲天堂中文资源| a最新无码国产在线视频| 直接看的成人无码视频网站| 精品久久久久久无码不卡| 国产精品久久久久无码av| 成人无码免费一区二区三区| 日韩中文字幕在线| 亚洲 无码 在线 专区| 精品深夜AV无码一区二区| 熟妇人妻中文av无码| 一本大道香蕉中文在线高清| 无码精品蜜桃一区二区三区WW| 亚洲av激情无码专区在线播放| 中文字幕无码成人免费视频| 亚洲精品乱码久久久久久中文字幕| HEYZO无码综合国产精品227| 亚洲AV无码不卡在线播放| 熟妇人妻系列aⅴ无码专区友真希 熟妇人妻系列av无码一区二区 | 久久无码av三级| 日韩乱码人妻无码中文字幕| 一区二区三区人妻无码| 无码人妻一区二区三区一| 久久久久亚洲AV片无码下载蜜桃| 亚洲乱码中文字幕综合| 狠狠躁天天躁中文字幕无码| 亚洲精品无码你懂的网站| 免费无码黄十八禁网站在线观看| 精品无码人妻一区二区三区| av无码播放一级毛片免费野外| 激情无码人妻又粗又大中国人 | 亚洲av永久无码精品古装片| 曰韩人妻无码一区二区三区综合部| 最近的2019免费中文字幕| 精品无码成人片一区二区98 | 在人线AV无码免费高潮喷水 | 无码精品国产一区二区三区免费| 寂寞少妇做spa按摩无码| 中文有无人妻vs无码人妻激烈|