CS 1501代做、代寫Python/Java程序設計

時間: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














 

標簽:

掃一掃在手機打開當前頁
  • 上一篇:代寫CSCI 2122、C++編程設計代做
  • 下一篇:代寫EECS 493、代做Java設計編程
  • 無相關信息
    昆明生活資訊

    昆明圖文信息
    蝴蝶泉(4A)-大理旅游
    蝴蝶泉(4A)-大理旅游
    油炸竹蟲
    油炸竹蟲
    酸筍煮魚(雞)
    酸筍煮魚(雞)
    竹筒飯
    竹筒飯
    香茅草烤魚
    香茅草烤魚
    檸檬烤魚
    檸檬烤魚
    昆明西山國家級風景名勝區
    昆明西山國家級風景名勝區
    昆明旅游索道攻略
    昆明旅游索道攻略
  • NBA直播 短信驗證碼平臺 幣安官網下載 歐冠直播 WPS下載

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

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

    亚洲成A人片在线观看无码3D| 中文字幕精品视频| 免费A级毛片无码专区| 无码人妻AV免费一区二区三区| 亚洲午夜国产精品无码老牛影视| 成人无码AV一区二区| 亚洲AV无码久久| 东京热加勒比无码视频| 高清无码在线视频| 亚洲男人第一无码aⅴ网站| 色婷婷综合久久久久中文 | 亚洲级αV无码毛片久久精品| 一区二区三区无码视频免费福利| 精品亚洲成在人线AV无码| 无码内射中文字幕岛国片| 久久激情亚洲精品无码?V| 精品久久亚洲中文无码| 国产欧美日韩中文字幕| 亚洲AV永久无码精品成人| 97碰碰碰人妻视频无码| 99久久无色码中文字幕人妻| 中文字幕精品久久| 日韩AV无码中文无码不卡电影| 国产亚洲精久久久久久无码AV| 久久久久久综合一区中文字幕| 丝袜无码一区二区三区| 国产在线精品无码二区| 日本中文字幕电影| 无码精品人妻一区二区三区人妻斩 | 欧洲精品久久久av无码电影| 人妻无码αv中文字幕久久琪琪布 人妻无码人妻有码中文字幕 | 无码中文人妻在线一区二区三区| 性无码专区一色吊丝中文字幕| 亚洲AV无码乱码国产麻豆| 手机在线观看?v无码片| 无码乱码av天堂一区二区| 精品久久无码中文字幕| 最近中文字幕电影大全免费版 | 人妻AV中出无码内射| 国产精品无码素人福利不卡| 最近中文字幕大全中文字幕免费|