Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

 

 

 

 def reachable_destinations(iata_src: str, n: int, routes: RouteDict) -> List[Set[str]]:
    """Return a list of the sets of airports where the set at index i is
    reachable in at most i flights. Note that iata_src will always appear at
    index 0, because it is reachable without flying anywhere.

    Precondition: n >= 0

    >>> reachable_destinations('AA1', 0, TEST_ROUTES_DICT_FOUR_CITIES)
    [{'AA1'}]
    >>> expected = [{'AA1'}, {'AA2', 'AA4'}]
    >>> result = reachable_destinations('AA1', 1, TEST_ROUTES_DICT_FOUR_CITIES)
    >>> expected == result
    True
    >>> expected = [{'AA1'}, {'AA2', 'AA4'}, {'AA3'}]
    >>> result = reachable_destinations('AA1', 2, TEST_ROUTES_DICT_FOUR_CITIES)
    >>> expected == result
    True
    """

    # Complete your function below

def count_outgoing_flights():
"""Return the number of outgoing flights for the airport with the iata in
the given routes information.
>>>count_outgoing_flights
('AA1',
TEST_ROUTES_DICT_FOUR_CITIES)
>>>count_outgoing_flights
('AA2',
TEST_ROUTES_DICT_FOUR_CITIES)
2
1
||||||
return len (routes [iata])
# Complete this function (including type contract and docstring)
#based on the handout description
pass
def count_incoming_flights():
"""Return the number of incoming flights for the airport with the iata in
the given routes information.
>>>count_incoming_flights ('AA1', TEST_ROUTES_DICT_FOUR_CITIES)
>>>count_incoming_flights ('AA2', TEST_ROUTES_DICT_FOUR_CITIES)
2
1
num=0
for i in routes:
if iata in routes [i]:
num+=1
return num
# Complete this function (including type contract and docstring)
#based on the handout description
pass
expand button
Transcribed Image Text:def count_outgoing_flights(): """Return the number of outgoing flights for the airport with the iata in the given routes information. >>>count_outgoing_flights ('AA1', TEST_ROUTES_DICT_FOUR_CITIES) >>>count_outgoing_flights ('AA2', TEST_ROUTES_DICT_FOUR_CITIES) 2 1 |||||| return len (routes [iata]) # Complete this function (including type contract and docstring) #based on the handout description pass def count_incoming_flights(): """Return the number of incoming flights for the airport with the iata in the given routes information. >>>count_incoming_flights ('AA1', TEST_ROUTES_DICT_FOUR_CITIES) >>>count_incoming_flights ('AA2', TEST_ROUTES_DICT_FOUR_CITIES) 2 1 num=0 for i in routes: if iata in routes [i]: num+=1 return num # Complete this function (including type contract and docstring) #based on the handout description pass
def count_total_flights():
# Complete this function (including type contract and docstring)
#based on the handout description
pass
def reachable_destinations (iata_src: str, n: int, routes: RouteDict) -> List [Set
"""Return a list of the sets of airports where the set at index i is
reachable in at most i flights. Note that iata_src will always appear at
index 0, because it is reachable without flying anywhere.
Precondition: n >= 0
>>> reachable_destinations ('AA1', 0, TEST_ROUTES_DICT_FOUR_CITIES)
[{'AA1'}]
>>> expected = [{'AA1'}, {'AA2', 'AA4'}]
>>> result = reachable_destinations ('AA1', 1, TEST_ROUTES_DICT_FOUR_CITIES)
>>> expected == result
True
>>> expected = [{'AA1'}, {'AA2', 'AA4'}, {'AA3'}]
>>> result = reachable_destinations ('AA1', 2, TEST_ROUTES_DICT_FOUR_CITIES)
>>> expected == result
True
||||||
# Complete your function below
expand button
Transcribed Image Text:def count_total_flights(): # Complete this function (including type contract and docstring) #based on the handout description pass def reachable_destinations (iata_src: str, n: int, routes: RouteDict) -> List [Set """Return a list of the sets of airports where the set at index i is reachable in at most i flights. Note that iata_src will always appear at index 0, because it is reachable without flying anywhere. Precondition: n >= 0 >>> reachable_destinations ('AA1', 0, TEST_ROUTES_DICT_FOUR_CITIES) [{'AA1'}] >>> expected = [{'AA1'}, {'AA2', 'AA4'}] >>> result = reachable_destinations ('AA1', 1, TEST_ROUTES_DICT_FOUR_CITIES) >>> expected == result True >>> expected = [{'AA1'}, {'AA2', 'AA4'}, {'AA3'}] >>> result = reachable_destinations ('AA1', 2, TEST_ROUTES_DICT_FOUR_CITIES) >>> expected == result True |||||| # Complete your function below
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education