Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose we are given a train map which consists of a set of 20 cities, and certain pairs of those cities are connected by direct

image text in transcribed

Suppose we are given a train map which consists of a set of 20 cities, and certain pairs of those

cities are connected by direct train lines. Note that a train between two cities does not necessarily travel

in both directions. Let S = {1, 2, ... 20} represent the set of cities, where each unique city is identified

with a number. Define a binary relation on S as follows: (a,b) E R if and only if there is a direct train

from city a to city b. A tourist is interested in going from one city to another using at most three trains.

Specifically, she would like to identify the pairs of cities (a, b) for which she can go from city a to city b

(where b is not a) using at most 3 trains.

Express these pairs in terms of the relation R. Justify your reasoning.

Suppose the train connections are stored in a double array T[ ][ ], where entry T[ i ][ j ] = true if there

is a direct train from city i to city j. Write the basic pseudo-code to print out all the pairs of cities

that are connected by exactly two trains.

2 2 (a) Suppose we are given a train map which consists of a set of 20 cities, and certain pairs of those cities are connected by direct train lines. Note that a train between two cities does not necessarily travel in both directions. Let S {1, 2, ...,20} represent the set of cities, where each unique city is identified with a number. Define a binary relation on S as follows: (a,b) E R if and only if there is a direct train from city a to city b. A tourist is interested in going from one city to another using at most three trains. Specifically, she would like to identify the pairs of cities (a,b) for which she can go from city a to city b (where b + a) using at most 3 trains. Express these pairs in terms of the relation R. Justify your reasoning. Suppose the train connections are stored in a double array T[]), where entry T[i][j] = true if there is a direct train from city i to city j. Write the basic pseudo-code to print out all the pairs of cities that are connected by exactly two trains

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Forensic Accounting

Authors: Greg Shields

1st Edition

1727480988, 978-1727480986

More Books

Students also viewed these Accounting questions